|
|
1.1 root 1: /*-----------------------------------------------------------
2: ABOUTBOX.C -- Demonstration of About Box Dialog Procedure
3: -----------------------------------------------------------*/
4:
5: #define INCL_WIN
6:
7: #include <os2.h>
8: #include <stddef.h>
9: #include "aboutbox.h"
10:
11: MRESULT EXPENTRY ClientWndProc (HWND, USHORT, MPARAM, MPARAM) ;
12:
13: int main (void)
14: {
15: static CHAR szClientClass[] = "AboutBox" ;
16: HAB hab ;
17: HMQ hmq ;
18: HWND hwndClient, hwndFrame ;
19: QMSG qmsg ;
20: ULONG flFrameFlags = FCF_STANDARD ;
21: ULONG flFrameStyle = WS_VISIBLE | FS_ICON ;
22:
23: hab = WinInitialize (0) ;
24: hmq = WinCreateMsgQueue (hab, 0) ;
25:
26: WinRegisterClass (hab, szClientClass, ClientWndProc, 0L, 0) ;
27:
28: hwndFrame = WinCreateStdWindow (HWND_DESKTOP, flFrameStyle,
29: &flFrameFlags, szClientClass,
30: "Sample About Box",
31: 0L, NULL, ID_RESOURCE, &hwndClient) ;
32:
33: while (WinGetMsg (hab, &qmsg, NULL, 0, 0))
34: WinDispatchMsg (hab, &qmsg) ;
35:
36: WinDestroyWindow (hwndFrame) ;
37: WinDestroyMsgQueue (hmq) ;
38: WinTerminate (hab) ;
39: return 0 ;
40: }
41:
42: MRESULT EXPENTRY AboutDlgProc (HWND hwnd, USHORT msg, MPARAM mp1, MPARAM mp2)
43: {
44: switch (msg)
45: {
46: case WM_COMMAND:
47: switch (COMMANDMSG(&msg)->cmd)
48: {
49: case DID_OK:
50: case DID_CANCEL:
51: WinDismissDlg (hwnd, TRUE) ;
52: return 0 ;
53: }
54: break ;
55: }
56: return WinDefDlgProc (hwnd, msg, mp1, mp2) ;
57: }
58:
59: MRESULT EXPENTRY ClientWndProc (HWND hwnd, USHORT msg, MPARAM mp1, MPARAM mp2)
60: {
61: switch (msg)
62: {
63: case WM_COMMAND:
64: switch (COMMANDMSG(&msg)->cmd)
65: {
66: case IDM_NEW:
67: case IDM_OPEN:
68: case IDM_SAVE:
69: case IDM_SAVEAS:
70: WinAlarm (HWND_DESKTOP, WA_NOTE) ;
71: return 0 ;
72:
73: case IDM_ABOUT:
74: WinDlgBox (HWND_DESKTOP, hwnd, AboutDlgProc,
75: NULL, IDD_ABOUT, NULL) ;
76: return 0 ;
77: }
78: break ;
79:
80: case WM_ERASEBACKGROUND:
81: return 1 ;
82: }
83: return WinDefWindowProc (hwnd, msg, mp1, mp2) ;
84: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.