Page 43 - DCAP408_WEB_PROGRAMMING
P. 43

Unit 3: Windows Programming




                 WNDCLASSEX     WndCls;                                                         Notes


                 . . .

                 RegisterClassEx(&WndClsEx);


                 CreateWindow(.  .  .);
          }
          If  you are preparing to use the window further in your application, you should recover  the
          result of the  CreateWindow() or the  CreateWindowEx()  function, which is  a handle to  the
          window that is being generated. To perform this, you can state an HWND variable and initialize
          it with the create function. This can be completed as follows:
          INT  WINAPI  WinMain(HINSTANCE  hInstance,  HINSTANCE  hPrevInstance,
                               LPSTR  lpCmdLine,  int  nCmdShow)
          {
                 HWND    hWnd;
                 WNDCLASSEX     WndClsEx;


                 . . .


                 RegisterClassEx(&WndClsEx);


                 hWnd  =  CreateWindow(.  .  .);
          }

          Self Assessment

          Fill in the blanks:

          10.  The WNDLCLASS and the ......................... classes are utilized to initialize the application
               window class.
          11.  To create a window, you can call either the CreateWindow() or the ......................... function.

          3.6 Message Processing Function WndProc()


          An application-defined function that processes messages sent to a window. The WNDPROC
          type defines a pointer to this callback function.
          WindowProc is a placeholder for the application-defined function name.

          Syntax

          LRESULT  CALLBACK  WindowProc(
              __in    HWND  hwnd,
              __in    UINT  uMsg,





                                           LOVELY PROFESSIONAL UNIVERSITY                                   37
   38   39   40   41   42   43   44   45   46   47   48