1 |
|
---|
2 | /***********************************************************************
|
---|
3 |
|
---|
4 | $Id: fm3.c 1078 2008-07-19 04:08:02Z stevenhl $
|
---|
5 |
|
---|
6 | fm/2 starter
|
---|
7 |
|
---|
8 | Copyright (c) 1993-98 M. Kimes
|
---|
9 | Copyright (c) 2008 Steven H.Levine
|
---|
10 |
|
---|
11 | 05 Jan 08 SHL Sync
|
---|
12 | 18 Jul 08 SHL Add Fortify support
|
---|
13 |
|
---|
14 | ***********************************************************************/
|
---|
15 |
|
---|
16 | #include <string.h>
|
---|
17 |
|
---|
18 | #define INCL_DOS
|
---|
19 | #define INCL_WIN
|
---|
20 | #define INCL_LONGLONG
|
---|
21 |
|
---|
22 | #include "dll\tools.h"
|
---|
23 | #include "dll\version.h"
|
---|
24 | #include "dll\errutil.h"
|
---|
25 | #include "dll\fortify.h"
|
---|
26 | #include "dll\fm3dll.h"
|
---|
27 |
|
---|
28 | int main(int argc, char *argv[])
|
---|
29 | {
|
---|
30 | HAB hab;
|
---|
31 | HMQ hmq;
|
---|
32 | QMSG qmsg;
|
---|
33 | HWND hwndFrame;
|
---|
34 |
|
---|
35 | strcpy(appname, "FM/3");
|
---|
36 | DosError(FERR_DISABLEHARDERR);
|
---|
37 | hab = WinInitialize(0);
|
---|
38 | if (hab) {
|
---|
39 | hmq = WinCreateMsgQueue(hab, 2048);
|
---|
40 | if (hmq) {
|
---|
41 | if (InitFM3DLL(hab, argc, argv)) {
|
---|
42 | if (CheckVersion(VERMAJOR, VERMINOR)) {
|
---|
43 | # ifdef FORTIFY
|
---|
44 | Fortify_EnterScope();
|
---|
45 | # endif
|
---|
46 | hwndFrame = StartFM3(hab, argc, argv);
|
---|
47 | if (hwndFrame != (HWND) 0) {
|
---|
48 | for (;;) {
|
---|
49 | if (!WinGetMsg(hab, &qmsg, (HWND) 0, 0, 0)) {
|
---|
50 | if (qmsg.hwnd)
|
---|
51 | qmsg.msg = WM_CLOSE;
|
---|
52 | else
|
---|
53 | break;
|
---|
54 | }
|
---|
55 | if (hwndBubble &&
|
---|
56 | ((qmsg.msg > (WM_BUTTON1DOWN - 1) &&
|
---|
57 | qmsg.msg < (WM_BUTTON3DBLCLK + 1)) ||
|
---|
58 | (qmsg.msg > (WM_CHORD - 1) &&
|
---|
59 | qmsg.msg < (WM_BUTTON3CLICK + 1))) &&
|
---|
60 | WinIsWindowVisible(hwndBubble))
|
---|
61 | WinShowWindow(hwndBubble, FALSE);
|
---|
62 | WinDispatchMsg(hab, &qmsg);
|
---|
63 | }
|
---|
64 | if (WinIsWindow(hab, WinWindowFromID(hwndFrame, FID_CLIENT)))
|
---|
65 | WinSendMsg(WinWindowFromID(hwndFrame, FID_CLIENT), WM_CLOSE,
|
---|
66 | MPVOID, MPVOID);
|
---|
67 | }
|
---|
68 | # ifdef FORTIFY
|
---|
69 | for (;;) {
|
---|
70 | UCHAR scope = Fortify_LeaveScope();
|
---|
71 | if ((CHAR)scope == 0)
|
---|
72 | break;
|
---|
73 | Runtime_Error(__FILE__, __LINE__, "Attempting to exit thread with scope non-zero (%u)", scope);
|
---|
74 | if ((CHAR)scope < 0)
|
---|
75 | break;
|
---|
76 | }
|
---|
77 | # endif
|
---|
78 | }
|
---|
79 | }
|
---|
80 | DosSleep(250L);
|
---|
81 | WinDestroyMsgQueue(hmq);
|
---|
82 | }
|
---|
83 | WinTerminate(hab);
|
---|
84 | }
|
---|
85 | return 0;
|
---|
86 | }
|
---|