home *** CD-ROM | disk | FTP | other *** search
/ Microsoft Programmer's Library 1.3 / Microsoft-Programers-Library-v1.3.iso / sampcode / os2sdk / os2sdk11 / petzold / chap02 / welcome.c < prev    next >
Encoding:
C/C++ Source or Header  |  1989-02-20  |  2.2 KB  |  59 lines

  1. /*-----------------------------------------------------
  2.    WELCOME.C -- A Program that Creates a Client Window
  3.   -----------------------------------------------------*/
  4.  
  5. #define INCL_WIN
  6. #include <os2.h>
  7.  
  8. MRESULT EXPENTRY ClientWndProc (HWND, USHORT, MPARAM, MPARAM) ;
  9.  
  10. int main (void)
  11.      {
  12.      static CHAR  szClientClass [] = "Welcome" ;
  13.      static ULONG flFrameFlags = FCF_TITLEBAR      | FCF_SYSMENU |
  14.                                  FCF_SIZEBORDER    | FCF_MINMAX  |
  15.                                  FCF_SHELLPOSITION | FCF_TASKLIST ;
  16.      HAB          hab ;
  17.      HMQ          hmq ;
  18.      HWND         hwndFrame, hwndClient ;
  19.      QMSG         qmsg ;
  20.  
  21.      hab = WinInitialize (0) ;
  22.      hmq = WinCreateMsgQueue (hab, 0) ;
  23.  
  24.      WinRegisterClass (
  25.                     hab,                // Anchor block handle
  26.                     szClientClass,      // Name of class being registered
  27.                     ClientWndProc,      // Window procedure for class
  28.                     0L,                 // Class style
  29.                     0) ;                // Extra bytes to reserve
  30.  
  31.      hwndFrame = WinCreateStdWindow (
  32.                     HWND_DESKTOP,       // Parent window handle
  33.                     WS_VISIBLE,         // Style of frame window
  34.                     &flFrameFlags,      // Pointer to control data
  35.                     szClientClass,      // Client window class name
  36.                     NULL,               // Title bar text
  37.                     0L,                 // Style of client window
  38.                     NULL,               // Module handle for resources
  39.                     0,                  // ID of resources
  40.                     &hwndClient) ;      // Pointer to client window handle
  41.  
  42.      WinSendMsg (hwndFrame, WM_SETICON,
  43.                  WinQuerySysPointer (HWND_DESKTOP, SPTR_APPICON, FALSE),
  44.                  NULL) ;
  45.  
  46.      while (WinGetMsg (hab, &qmsg, NULL, 0, 0))
  47.           WinDispatchMsg (hab, &qmsg) ;
  48.  
  49.      WinDestroyWindow (hwndFrame) ;
  50.      WinDestroyMsgQueue (hmq) ;
  51.      WinTerminate (hab) ;
  52.      return 0 ;
  53.      }
  54.  
  55. MRESULT EXPENTRY ClientWndProc (HWND hwnd, USHORT msg, MPARAM mp1, MPARAM mp2)
  56.      {
  57.      return WinDefWindowProc (hwnd, msg, mp1, mp2) ;
  58.      }
  59.