|
|
1.1 root 1: /*----------------------------------------------------------
2: WELCOME1.C -- A Program that Writes to its Client Window
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 [] = "Welcome1" ;
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 (
25: hab, // Anchor block handle
26: szClientClass, // Name of class being registered
27: ClientWndProc, // Window procedure for class
28: CS_SIZEREDRAW, // Class style
29: 0) ; // Extra bytes to reserve
30:
31: hwndFrame = WinCreateStdWindow (
32: HWND_DESKTOP, // Parent window handle
33: WS_VISIBLE, // Style of frame window
34: &flFrameFlags, // Pointer to control data
35: szClientClass, // Client window class name
36: NULL, // Title bar text
37: 0L, // Style of client window
38: NULL, // Module handle for resources
39: 0, // ID of resources
40: &hwndClient) ; // Pointer to client window handle
41:
42: WinSendMsg (hwndFrame, WM_SETICON,
43: WinQuerySysPointer (HWND_DESKTOP, SPTR_APPICON, FALSE),
44: NULL) ;
45:
46: while (WinGetMsg (hab, &qmsg, NULL, 0, 0))
47: WinDispatchMsg (hab, &qmsg) ;
48:
49: WinDestroyWindow (hwndFrame) ;
50: WinDestroyMsgQueue (hmq) ;
51: WinTerminate (hab) ;
52: return 0 ;
53: }
54:
55: MRESULT EXPENTRY ClientWndProc (HWND hwnd, USHORT msg, MPARAM mp1, MPARAM mp2)
56: {
57: static CHAR szText [] = "Welcome to the OS/2 Presentation Manager" ;
58: HPS hps;
59: RECTL rcl ;
60:
61: switch (msg)
62: {
63: case WM_CREATE:
64: DosBeep (261, 100) ;
65: DosBeep (330, 100) ;
66: DosBeep (392, 100) ;
67: DosBeep (523, 500) ;
68: return 0 ;
69:
70: case WM_PAINT:
71: hps = WinBeginPaint (hwnd, NULL, NULL) ;
72:
73: WinQueryWindowRect (hwnd, &rcl) ;
74:
75: WinDrawText (hps, -1, szText, &rcl, CLR_NEUTRAL, CLR_BACKGROUND,
76: DT_CENTER | DT_VCENTER | DT_ERASERECT) ;
77:
78: WinEndPaint (hps) ;
79: return 0 ;
80:
81: case WM_DESTROY:
82: DosBeep (523, 100) ;
83: DosBeep (392, 100) ;
84: DosBeep (330, 100) ;
85: DosBeep (261, 500) ;
86: return 0 ;
87: }
88: return WinDefWindowProc (hwnd, msg, mp1, mp2) ;
89: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.