source: trunk/fm4.c@ 1341

Last change on this file since 1341 was 1341, checked in by Steven Levine, 17 years ago

Ticket 26: add thread 1 exception handler support to applets

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.4 KB
Line 
1
2/***********************************************************************
3
4 $Id: fm4.c 1341 2008-12-14 22:18:26Z stevenhl $
5
6 fm/2 lite applet
7
8 Copyright (c) 1993-98 M. Kimes
9 Copyright (c) 2008 Steven H.Levine
10
11 05 Jan 08 SHL Sync
12 14 Dec 08 SHL Add exception handler support
13
14***********************************************************************/
15
16#include <string.h>
17
18#define INCL_DOS
19#define INCL_WIN
20#define INCL_LONGLONG
21#define INCL_DOSEXCEPTIONS // XCTP_...
22#define INCL_DOSERRORS // NO_ERROR
23
24#include "dll\fm3dll.h"
25#include "dll\mainwnd.h" // hwndBubble
26#include "dll\notebook.h" // appname
27#include "dll\tools.h"
28#include "dll\version.h"
29#include "dll\mainwnd2.h" // StartFM32
30#include "dll\init.h" // InitFM3DLL
31#include "dll\errutil.h" // Error reporting
32#include "dll\excputil.h" // Exception handlers
33
34static PSZ pszSrcFile = __FILE__;
35
36int main(int argc, char *argv[])
37{
38 HAB hab;
39 HMQ hmq;
40 QMSG qmsg;
41 HWND hwndFrame;
42 APIRET regRet;
43 UINT x;
44 EXCEPTIONREGISTRATIONRECORD regRec = { NULL, NULL };
45
46 strcpy(appname, "FM/4");
47 DosError(FERR_DISABLEHARDERR);
48
49 regRec.ExceptionHandler = HandleException;
50 regRet = DosSetExceptionHandler(&regRec);
51 if (regRet != NO_ERROR) {
52 DbgMsg(pszSrcFile, __LINE__,
53 "DosSetExceptionHandler failed with error %u", regRet);
54 }
55
56 for (x = 1; x < argc; x++) {
57 if (*argv[x] == '+' && !argv[x][1])
58 fLogFile = TRUE;
59 if (*argv[x] == '-') {
60 if (argv[x][1])
61 strcpy(profile, &argv[x][1]);
62 }
63 }
64
65 hab = WinInitialize(0);
66 if (hab) {
67 hmq = WinCreateMsgQueue(hab, 2048);
68 if (hmq) {
69 if (InitFM3DLL(hab, argc, argv)) {
70 if (CheckVersion(VERMAJOR, VERMINOR)) {
71 hwndFrame = StartFM32(hab, argc, argv);
72 if (hwndFrame != (HWND) 0) {
73 for (;;) {
74 if (!WinGetMsg(hab, &qmsg, (HWND) 0, 0, 0)) {
75 if (qmsg.hwnd)
76 qmsg.msg = WM_CLOSE;
77 else
78 break;
79 }
80 if (hwndBubble &&
81 ((qmsg.msg > (WM_BUTTON1DOWN - 1) &&
82 qmsg.msg < (WM_BUTTON3DBLCLK + 1)) ||
83 (qmsg.msg > (WM_CHORD - 1) &&
84 qmsg.msg < (WM_BUTTON3CLICK + 1))) &&
85 WinIsWindowVisible(hwndBubble))
86 WinShowWindow(hwndBubble, FALSE);
87 WinDispatchMsg(hab, &qmsg);
88 }
89 if (WinIsWindow(hab, WinWindowFromID(hwndFrame, FID_CLIENT)))
90 WinSendMsg(WinWindowFromID(hwndFrame,
91 FID_CLIENT),
92 WM_CLOSE, MPVOID, MPVOID);
93 }
94 }
95 }
96 DosSleep(250L);
97 WinDestroyMsgQueue(hmq);
98 }
99 WinTerminate(hab);
100 }
101 return 0;
102}
Note: See TracBrowser for help on using the repository browser.