Page 74 - DCAP408_WEB_PROGRAMMING
P. 74

Windows Programming




                    Notes          9.  Click Finish
                                   10.  In the left frame, double-click Exercise.cpp and modify the file to the following:
                                       #include <windows.h>
                                       #ifdef __BORLANDC__
                                       #pragma argsused
                                       #endif



                                       const char *ClsName = “CtrlExos”;
                                       const char *WndName = “Controls Examples”;
                                       HINSTANCE hInst;


                                       LRESULT CALLBACK WndProcedure(HWND hWnd, UINT uMsg,
                                                                  WPARAM wParam, LPARAM lParam);


                                       int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,

                                                    LPSTR lpCmdLine, int nCmdShow)
                                       {
                                               MSG        Msg;
                                               HWND       hWnd;
                                               WNDCLASSEX WndClsEx;


                                               hInst = hInstance;


                                               // Create the application window
                                               WndClsEx.cbSize        = sizeof(WNDCLASSEX);
                                               WndClsEx.style         = CS_HREDRAW | CS_VREDRAW;

                                               WndClsEx.lpfnWndProc   = WndProcedure;
                                               WndClsEx.cbClsExtra    = 0;
                                               WndClsEx.cbWndExtra    = 0;
                                               WndClsEx.hIcon         = LoadIcon(NULL, IDI_APPLICATION);
                                               WndClsEx.hCursor       = LoadCursor(NULL, IDC_ARROW);
                                               WndClsEx.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
                                               WndClsEx.lpszMenuName  = NULL;
                                               WndClsEx.lpszClassName = ClsName;
                                               WndClsEx.hInstance     = hInst;

                                               WndClsEx.hIconSm       = LoadIcon(NULL, IDI_APPLICATION);






          68                                LOVELY PROFESSIONAL UNIVERSITY
   69   70   71   72   73   74   75   76   77   78   79