Annotation of pmsdk/samples/petzold/chap16/hdrtest.c, revision 1.1

1.1     ! root        1: /*--------------------------------------------------------------
        !             2:    HDRTEST.C -- Program to Test HDRLIB.DLL Dynamic Link Library
        !             3:   --------------------------------------------------------------*/
        !             4: 
        !             5: #define INCL_WIN
        !             6: #include <os2.h>
        !             7: #include "hdrlib.h"
        !             8: 
        !             9: MRESULT EXPENTRY ClientWndProc (HWND, USHORT, MPARAM, MPARAM) ;
        !            10: 
        !            11: int main (void)
        !            12:      {
        !            13:      static CHAR  szClientClass [] = "HdrTest" ;
        !            14:      static ULONG flFrameFlags = FCF_TITLEBAR      | FCF_SYSMENU |
        !            15:                                  FCF_SIZEBORDER    | FCF_MINMAX  |
        !            16:                                  FCF_SHELLPOSITION | FCF_TASKLIST ;
        !            17:      HAB            hab ;
        !            18:      HMQ            hmq ;
        !            19:      HWND           hwndFrame, hwndClient ;
        !            20:      QMSG           qmsg ;
        !            21: 
        !            22:      hab = WinInitialize (0) ;
        !            23:      hmq = WinCreateMsgQueue (hab, 0) ;
        !            24: 
        !            25:      WinRegisterClass (hab, szClientClass, ClientWndProc, CS_SIZEREDRAW, 0) ;
        !            26: 
        !            27:      hwndFrame = WinCreateStdWindow (HWND_DESKTOP, WS_VISIBLE,
        !            28:                                      &flFrameFlags, szClientClass, NULL,
        !            29:                                      0L, NULL, 0, &hwndClient) ;
        !            30: 
        !            31:      WinSendMsg (hwndFrame, WM_SETICON,
        !            32:                  WinQuerySysPointer (HWND_DESKTOP, SPTR_APPICON, FALSE),
        !            33:                  NULL) ;
        !            34: 
        !            35:      while (WinGetMsg (hab, &qmsg, NULL, 0, 0))
        !            36:           WinDispatchMsg (hab, &qmsg) ;
        !            37: 
        !            38:      WinDestroyWindow (hwndFrame) ;
        !            39:      WinDestroyMsgQueue (hmq) ;
        !            40:      WinTerminate (hab) ;
        !            41:      return 0 ;
        !            42:      }
        !            43: 
        !            44: MRESULT EXPENTRY ClientWndProc (HWND hwnd, USHORT msg, MPARAM mp1, MPARAM mp2)
        !            45:      {
        !            46:      static SHORT cxClient, cyClient ;
        !            47:      HPS          hps;
        !            48:      POINTL       ptl ;
        !            49: 
        !            50:      switch (msg)
        !            51:          {
        !            52:           case WM_SIZE:
        !            53:                cxClient = SHORT1FROMMP (mp2) ;
        !            54:                cyClient = SHORT2FROMMP (mp2) ;
        !            55:                return 0 ;
        !            56: 
        !            57:           case WM_PAINT:
        !            58:                hps = WinBeginPaint (hwnd, NULL, NULL) ;
        !            59:                GpiErase (hps) ;
        !            60: 
        !            61:                ptl.x = cxClient / 8 ;
        !            62:                ptl.y = 3 * cyClient / 4 ;
        !            63:                HdrPrintf (hps, &ptl, "Welcome to the %s",
        !            64:                           (PCHAR) "OS/2 Presentation Manager") ;
        !            65: 
        !            66:                ptl.x = cxClient / 8 ;
        !            67:                ptl.y = cyClient / 4 ;
        !            68:                HdrPuts (hps, &ptl, "This line was displayed by a ") ;
        !            69:                HdrPuts (hps, NULL, "routine in a dynamic link library.") ;
        !            70: 
        !            71:                ptl.x = 0 ;
        !            72:                ptl.y = 0 ;
        !            73:                GpiMove (hps, &ptl) ;
        !            74: 
        !            75:                ptl.x = cxClient - 1 ;
        !            76:                ptl.y = cyClient - 1 ;
        !            77:                HdrEllipse (hps, DRO_OUTLINE, &ptl) ;
        !            78: 
        !            79:                WinEndPaint (hps) ;
        !            80:                return 0 ;
        !            81:           }
        !            82:      return WinDefWindowProc (hwnd, msg, mp1, mp2) ;
        !            83:      }

unix.superglobalmegacorp.com

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