Annotation of pmsdk/samples/petzold/chap06/minmax2.c, revision 1.1

1.1     ! root        1: /*-----------------------------------------------
        !             2:    MINMAX2.C -- Bitblt of Minimize-Maximize Menu
        !             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 [] = "MinMax2" ;
        !            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 (hab, szClientClass, ClientWndProc, CS_SIZEREDRAW, 0) ;
        !            25: 
        !            26:      hwndFrame = WinCreateStdWindow (HWND_DESKTOP, WS_VISIBLE,
        !            27:                                      &flFrameFlags, szClientClass, NULL,
        !            28:                                      0L, NULL, 0, &hwndClient) ;
        !            29: 
        !            30:      WinSendMsg (hwndFrame, WM_SETICON,
        !            31:                  WinQuerySysPointer (HWND_DESKTOP, SPTR_APPICON, FALSE),
        !            32:                  NULL) ;
        !            33: 
        !            34:      while (WinGetMsg (hab, &qmsg, NULL, 0, 0))
        !            35:           WinDispatchMsg (hab, &qmsg) ;
        !            36: 
        !            37:      WinDestroyWindow (hwndFrame) ;
        !            38:      WinDestroyMsgQueue (hmq) ;
        !            39:      WinTerminate (hab) ;
        !            40:      return 0 ;
        !            41:      }
        !            42: 
        !            43: MRESULT EXPENTRY ClientWndProc (HWND hwnd, USHORT msg, MPARAM mp1, MPARAM mp2)
        !            44:      {
        !            45:      static LONG  cxMinMax, cyMinMax ;
        !            46:      static SHORT cxClient, cyClient ;
        !            47:      HPS          hps ;
        !            48:      POINTL       aptl[4] ;
        !            49: 
        !            50:      switch (msg)
        !            51:           {
        !            52:           case WM_CREATE:
        !            53:                cxMinMax = WinQuerySysValue (HWND_DESKTOP, SV_CXMINMAXBUTTON) ;
        !            54:                cyMinMax = WinQuerySysValue (HWND_DESKTOP, SV_CYMINMAXBUTTON) ;
        !            55:                return 0 ;
        !            56: 
        !            57:           case WM_SIZE:
        !            58:                cxClient = SHORT1FROMMP (mp2) ;
        !            59:                cyClient = SHORT2FROMMP (mp2) ;
        !            60:                return 0 ;
        !            61: 
        !            62:           case WM_PAINT:
        !            63:                hps = WinBeginPaint (hwnd, NULL, NULL) ;
        !            64:                GpiErase (hps) ;
        !            65: 
        !            66:                aptl[0].x = 0 ;                    // target lower left
        !            67:                aptl[0].y = 0 ;
        !            68: 
        !            69:                aptl[1].x = cxClient ;             // target upper right
        !            70:                aptl[1].y = cyClient ;
        !            71: 
        !            72:                aptl[2].x = cxClient - cxMinMax ;  // source lower left
        !            73:                aptl[2].y = cyClient ;
        !            74: 
        !            75:                aptl[3].x = cxClient ;             // source upper right
        !            76:                aptl[3].y = cyClient + cyMinMax ;
        !            77: 
        !            78:                GpiBitBlt (hps, hps, 4L, aptl, ROP_SRCCOPY, BBO_AND) ;
        !            79: 
        !            80:                WinEndPaint (hps) ;
        !            81:                return 0 ;
        !            82:           }
        !            83:      return WinDefWindowProc (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.