/* skel2 */ /* skeletal windoze program */ #include int PASCAL WinMain(HINSTANCE hinstCurrent, HINSTANCE hinstPrevious, LPSTR lpszCmdLine, int nCmdShow) char szWinName[] ="MyWin"; // name of window class { HWND hwnd; MSG msg; WNDCLASS myWC; /* DEFINE THE WINDOW CLASS */ HINSTANCE hinst; char szMyClass[] = "MyClass"; /* Register the window class. */ myWC.style = 0; myWC.lpfnWndProc = WindowFunc; myWC.cbClsExtra = 0; myWC.cbWndExtra = 0; myWC.hInstance = hinst; myWC.hIcon = LoadIcon(hinst, "MyIcon"); myWC.hCursor = LoadCursor(NULL, IDC_ARROW); myWC.hbrBackground = (HBRUSH) (COLOR_WINDOW + 1); myWC.lpszMenuName = NULL; myWC.lpszClassName = szMyClass; if (!RegisterClass(&myWC)) return FALSE; /* Create the window. */ hwnd = CreateWindow(szMyClass, "MyApp", WS_OVERLAPPED | WS_SYSMENU, CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hinst, NULL ); /////////////////// if (hinstPrevious == NULL) /* other instances? */ if (!InitApplication(hinstCurrent)) /* shared items */ return FALSE; /* initialization failed */ /* Perform initializations for this instance. */ if (!InitInstance(hinstCurrent, nCmdShow)) return FALSE; /* Get and dispatch messages until WM_QUIT message. */ while (GetMessage(&msg, NULL, 0, 0)) { TranslateMessage(&msg); /* translates virtual key codes */ DispatchMessage(&msg); /* dispatches message to window */ } return (int) msg.wParam; /* return value of PostQuitMessage */ }