Annotation of pmsdk/samples/petzold/chap14/aboutbox.c, revision 1.1.1.1

1.1       root        1: /*-----------------------------------------------------------
                      2:    ABOUTBOX.C -- Demonstration of About Box Dialog Procedure
                      3:   -----------------------------------------------------------*/
                      4: 
                      5: #define INCL_WIN
                      6: #include <os2.h>
                      7: #include "aboutbox.h"
                      8: 
                      9: MRESULT EXPENTRY ClientWndProc (HWND, USHORT, MPARAM, MPARAM) ;
                     10: MRESULT EXPENTRY AboutDlgProc  (HWND, USHORT, MPARAM, MPARAM) ;
                     11: 
                     12: int main (void)
                     13:      {
                     14:      static CHAR  szClientClass[] = "AboutBox" ;
                     15:      static ULONG flFrameFlags = FCF_TITLEBAR      | FCF_SYSMENU |
                     16:                                  FCF_SIZEBORDER    | FCF_MINMAX  |
                     17:                                  FCF_SHELLPOSITION | FCF_TASKLIST |
                     18:                                  FCF_MENU          | FCF_ICON ;
                     19:      HAB          hab ;
                     20:      HMQ          hmq ;
                     21:      HWND         hwndFrame, hwndClient ;
                     22:      QMSG         qmsg ;
                     23: 
                     24:      hab = WinInitialize (0) ;
                     25:      hmq = WinCreateMsgQueue (hab, 0) ;
                     26: 
                     27:      WinRegisterClass (hab, szClientClass, ClientWndProc, 0L, 0) ;
                     28: 
                     29:      hwndFrame = WinCreateStdWindow (HWND_DESKTOP, WS_VISIBLE,
                     30:                                      &flFrameFlags, szClientClass, NULL,
                     31:                                     0L, NULL, ID_RESOURCE, &hwndClient) ;
                     32: 
                     33:      while (WinGetMsg (hab, &qmsg, NULL, 0, 0))
                     34:           WinDispatchMsg (hab, &qmsg) ;
                     35: 
                     36:      WinDestroyWindow (hwndFrame) ;
                     37:      WinDestroyMsgQueue (hmq) ;
                     38:      WinTerminate (hab) ;
                     39:      return 0 ;
                     40:      }
                     41: 
                     42: MRESULT EXPENTRY ClientWndProc (HWND hwnd, USHORT msg, MPARAM mp1, MPARAM mp2)
                     43:      {
                     44:      switch (msg)
                     45:           {
                     46:           case WM_COMMAND:
                     47:                switch (COMMANDMSG(&msg)->cmd)
                     48:                     {
                     49:                     case IDM_NEW:
                     50:                     case IDM_OPEN:
                     51:                     case IDM_SAVE:
                     52:                     case IDM_SAVEAS:
                     53:                          WinAlarm (HWND_DESKTOP, WA_NOTE) ;
                     54:                          return 0 ;
                     55: 
                     56:                     case IDM_ABOUT:
                     57:                          WinDlgBox (HWND_DESKTOP, hwnd, AboutDlgProc,
                     58:                                     NULL, IDD_ABOUT, NULL) ;
                     59:                          return 0 ;
                     60:                     }
                     61:                break ;
                     62: 
                     63:           case WM_ERASEBACKGROUND:
                     64:                return 1 ;
                     65:           }
                     66:      return WinDefWindowProc (hwnd, msg, mp1, mp2) ;
                     67:      }
                     68: 
                     69: MRESULT EXPENTRY AboutDlgProc (HWND hwnd, USHORT msg, MPARAM mp1, MPARAM mp2)
                     70:      {
                     71:      switch (msg)
                     72:           {
                     73:           case WM_COMMAND:
                     74:                switch (COMMANDMSG(&msg)->cmd)
                     75:                     {
                     76:                     case DID_OK:
                     77:                     case DID_CANCEL:
                     78:                          WinDismissDlg (hwnd, TRUE) ;
                     79:                          return 0 ;
                     80:                     }
                     81:                break ;
                     82:           }
                     83:      return WinDefDlgProc (hwnd, msg, mp1, mp2) ;
                     84:      }

unix.superglobalmegacorp.com

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