Annotation of pmsdk/samples/petzold/chap02/welcome.c, revision 1.1.1.2

1.1.1.2 ! root        1: /*-----------------------------------------------------
        !             2:    WELCOME.C -- A Program that Creates a Client Window
        !             3:   -----------------------------------------------------*/
1.1       root        4: 
1.1.1.2 ! root        5: #define INCL_WIN
1.1       root        6: #include <os2.h>
                      7: 
                      8: MRESULT EXPENTRY ClientWndProc (HWND, USHORT, MPARAM, MPARAM) ;
                      9: 
                     10: int main (void)
                     11:      {
1.1.1.2 ! root       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 ;
1.1       root       20: 
                     21:      hab = WinInitialize (0) ;
                     22:      hmq = WinCreateMsgQueue (hab, 0) ;
                     23: 
                     24:      WinRegisterClass (
1.1.1.2 ! root       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
1.1       root       30: 
                     31:      hwndFrame = WinCreateStdWindow (
1.1.1.2 ! root       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) ;
1.1       root       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:      }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.