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

1.1     ! root        1: /*-----------------------------------------------
        !             2:    MINMAX1.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 [] = "MinMax1" ;
        !            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[3] ;
        !            49:      LONG         lRow, lCol ;
        !            50: 
        !            51:      switch (msg)
        !            52:           {
        !            53:           case WM_CREATE:
        !            54:                cxMinMax = WinQuerySysValue (HWND_DESKTOP, SV_CXMINMAXBUTTON) ;
        !            55:                cyMinMax = WinQuerySysValue (HWND_DESKTOP, SV_CYMINMAXBUTTON) ;
        !            56:                return 0 ;
        !            57: 
        !            58:           case WM_SIZE:
        !            59:                cxClient = SHORT1FROMMP (mp2) ;
        !            60:                cyClient = SHORT2FROMMP (mp2) ;
        !            61:                return 0 ;
        !            62: 
        !            63:           case WM_PAINT:
        !            64:                hps = WinBeginPaint (hwnd, NULL, NULL) ;
        !            65: 
        !            66:                GpiErase (hps) ;
        !            67: 
        !            68:                for (lRow = 0 ; lRow <= cyClient / cyMinMax ; lRow++)
        !            69:                     for (lCol = 0 ; lCol <= cxClient / cxMinMax ; lCol++)
        !            70:                          {
        !            71:                          aptl[0].x = lCol * cxMinMax ;      // target
        !            72:                          aptl[0].y = lRow * cyMinMax ;      //   lower left
        !            73: 
        !            74:                          aptl[1].x = aptl[0].x + cxMinMax ; // target
        !            75:                          aptl[1].y = aptl[0].y + cyMinMax ; //   upper right
        !            76: 
        !            77:                          aptl[2].x = cxClient - cxMinMax ;  // source
        !            78:                          aptl[2].y = cyClient ;             //   lower left
        !            79: 
        !            80:                          GpiBitBlt (hps, hps, 3L, aptl, ROP_SRCCOPY, BBO_AND) ;
        !            81:                          }
        !            82:                WinEndPaint (hps) ;
        !            83:                return 0 ;
        !            84:           }
        !            85:      return WinDefWindowProc (hwnd, msg, mp1, mp2) ;
        !            86:      }

unix.superglobalmegacorp.com

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