|
|
1.1 root 1: /*---------------------------------------
2: MINMAX3.C -- Minimize-Maximize Bitmap
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 [] = "MinMax3" ;
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: while (WinGetMsg (hab, &qmsg, NULL, 0, 0))
31: WinDispatchMsg (hab, &qmsg) ;
32:
33: WinDestroyWindow (hwndFrame) ;
34: WinDestroyMsgQueue (hmq) ;
35: WinTerminate (hab) ;
36: return 0 ;
37: }
38:
39: MRESULT EXPENTRY ClientWndProc (HWND hwnd, USHORT msg, MPARAM mp1, MPARAM mp2)
40: {
41: static SHORT cxClient, cyClient ;
42: HBITMAP hbmMin, hbmMax ;
43: HPS hps ;
44: POINTL aptl [2] ;
45:
46: switch (msg)
47: {
48: case WM_SIZE:
49: cxClient = SHORT1FROMMP (mp2) ;
50: cyClient = SHORT2FROMMP (mp2) ;
51: return 0 ;
52:
53: case WM_PAINT:
54: hps = WinBeginPaint (hwnd, NULL, NULL) ;
55:
56: hbmMin = WinGetSysBitmap (HWND_DESKTOP, SBMP_MINBUTTON) ;
57: hbmMax = WinGetSysBitmap (HWND_DESKTOP, SBMP_MAXBUTTON) ;
58:
59: aptl[0].x = 0 ; // Target lower left
60: aptl[0].y = 0 ;
61: aptl[1].x = cxClient / 2 ; // Target upper right
62: aptl[1].y = cyClient ;
63:
64: WinDrawBitmap (hps, hbmMin, NULL, aptl,
65: CLR_NEUTRAL, CLR_BACKGROUND, DBM_STRETCH) ;
66:
67: aptl[0].x = cxClient / 2 ; // Target left
68: aptl[1].x = cxClient ; // Target right
69:
70: WinDrawBitmap (hps, hbmMax, NULL, aptl,
71: CLR_NEUTRAL, CLR_BACKGROUND, DBM_STRETCH) ;
72:
73: GpiDeleteBitmap (hbmMin) ;
74: GpiDeleteBitmap (hbmMax) ;
75:
76: WinEndPaint (hps) ;
77: return 0 ;
78: }
79: return WinDefWindowProc (hwnd, msg, mp1, mp2) ;
80: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.