Page 51 - DCAP408_WEB_PROGRAMMING
P. 51

Unit 4: Windows Controls




          4.2 The Create Windows() Function                                                     Notes

          Window controls are considered as predefined window classes i.e. you are not required to call
          the Register Class() function to generate a window class before the control.

          Windows are usually generated using the “CreateWindow” function, even though there are a
          few other functions that are functional as well. Once a WNDCLASS has been registered, you can
          inform the system to make a window from that class by passing the class name (keep in mind
          that global string we defined?) to the CreateWindow function.
          HWND  CreateWindow(
                LPCTSTR  lpClassName,
                LPCTSTR  lpWindowName,
                DWORD  dwStyle,
             int x,
             int y,
                int  nWidth,
                int  nHeight,
                HWND  hWndParent,
                HMENU  hMenu,
                HINSTANCE  hInstance,
                LPVOID  lpParam
          );
          The first  parameter, “lpClassName”  is the  string  connected  with  our  window  class.  The
          “lpWindowName” parameter is the title that will be exhibited in the title bar of our window (if
          the window has a title bar).
          “dwStyle” is a field that includes a number of bit-wise OR’d flags, that will control window
          creation.
          Self Assessment


          Fill in the blank:
          2.   Window controls are considered as predefined window classes i.e. you are not required to
               call the ................................. function to generate a window class before the control.
          4.3 Static Controls


          We will  illustrate here regarding the text static control. A text static  control is  like an  edit
          control, but it does not obtain typed input from the user. A static control cannot be chosen and
          cannot obtain the keyboard focus. A static control is usually used as a label for other controls.


                 Example: If you have an edit control, you would usually use a static control on the left or
          above the edit control. This static control is a label and would have text that signifies the reason
          of the edit control.
          The static control is of the system window class, STATIC.






                                           LOVELY PROFESSIONAL UNIVERSITY                                   45
   46   47   48   49   50   51   52   53   54   55   56