1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
|
/* Standard C(++) include files. */
#include <iostream>
#include <cstdlib>
/* Include file for the Win32 API. */
#include <windows.h>
/* Window procedure coming in the future. For now the application will crash when an event reaches it. */
LRESULT CALLBACK my_window_procedure ( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam )
{
}
int WINAPI WinMain ( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCommandLine, int nCmdShow )
{
/* Our window class for the main window and a handle to our main window. */
WNDCLASSEX my_window_class;
HWND main_window;
/* Initialize all members of the window class to zero, so we don't have
to worry about those members which we don't care about now. */
memset ( & my_window_class, 0, sizeof ( my_window_class ) );
/* Set some window class members which are of importance to us and
register it. */
my_window_class.cbSize = sizeof ( my_window_class );
my_window_class.style = CS_HREDRAW | CS_VREDRAW;
my_window_class.lpfnWndProc = my_window_procedure;
my_window_class.hInstance = hInstance;
my_window_class.lpszClassName = "my_window_class";
RegisterClassEx ( & my_window_class );
/* Create a window with a border and caption and set our handle to point to
it.*/
main_window = CreateWindow ( "my_window_class", "My First Windows Application", WS_CAPTION, 0, 0, 250, 250, NULL, NULL, hInstance, NULL );
/* Show that window */
ShowWindow ( main_window, nCmdShow );
/* Stop the program from exiting directly. */
std::cin.get ( );
return ( 0 );
}
|