[907] | 1 |
|
---|
| 2 | /***********************************************************************
|
---|
| 3 |
|
---|
| 4 | $Id: global.c 1341 2008-12-14 22:18:26Z stevenhl $
|
---|
| 5 |
|
---|
| 6 | See all files applet
|
---|
| 7 |
|
---|
| 8 | Copyright (c) 1993-98 M. Kimes
|
---|
| 9 | Copyright (c) 2008 Steven H.Levine
|
---|
| 10 |
|
---|
| 11 | 05 Jan 08 SHL Sync
|
---|
[1341] | 12 | 14 Dec 08 SHL Add exception handler support
|
---|
[907] | 13 |
|
---|
| 14 | ***********************************************************************/
|
---|
| 15 |
|
---|
| 16 | #include <string.h>
|
---|
| 17 |
|
---|
[2] | 18 | #define INCL_DOS
|
---|
| 19 | #define INCL_WIN
|
---|
[1341] | 20 | #define INCL_DOSEXCEPTIONS // XCTP_...
|
---|
| 21 | #define INCL_DOSERRORS // NO_ERROR
|
---|
[2] | 22 |
|
---|
| 23 | #include "dll\fm3dll.h"
|
---|
[1341] | 24 | #include "dll\mainwnd.h" // hwndBubble
|
---|
| 25 | #include "dll\notebook.h" // appname
|
---|
[1176] | 26 | #include "dll\fm3str.h"
|
---|
[1341] | 27 | #include "dll\seeall.h" // StartSeeAll
|
---|
[1176] | 28 | #include "dll\valid.h" // IsFile
|
---|
| 29 | #include "dll\init.h" // InitFM3DLL
|
---|
[1341] | 30 | #include "dll\errutil.h" // Error reporting
|
---|
| 31 | #include "dll\excputil.h" // Exception handlers
|
---|
[2] | 32 |
|
---|
[1341] | 33 | static PSZ pszSrcFile = __FILE__;
|
---|
| 34 |
|
---|
[551] | 35 | int main(int argc, char *argv[])
|
---|
| 36 | {
|
---|
| 37 | HAB hab;
|
---|
| 38 | HMQ hmq;
|
---|
| 39 | QMSG qmsg;
|
---|
| 40 | HWND hwndFrame;
|
---|
[1341] | 41 | CHAR fullname[CCHMAXPATH] = { 0 }; // 14 Dec 08 SHL was static
|
---|
| 42 | UINT x;
|
---|
| 43 | APIRET regRet;
|
---|
| 44 | EXCEPTIONREGISTRATIONRECORD regRec = { NULL, NULL };
|
---|
[2] | 45 |
|
---|
[551] | 46 | strcpy(appname, "SEEALL");
|
---|
[2] | 47 | DosError(FERR_DISABLEHARDERR);
|
---|
[1341] | 48 |
|
---|
| 49 | regRec.ExceptionHandler = HandleException;
|
---|
| 50 | regRet = DosSetExceptionHandler(®Rec);
|
---|
| 51 | if (regRet != NO_ERROR) {
|
---|
| 52 | DbgMsg(pszSrcFile, __LINE__,
|
---|
| 53 | "DosSetExceptionHandler failed with error %u", regRet);
|
---|
| 54 | }
|
---|
| 55 |
|
---|
[2] | 56 | hab = WinInitialize(0);
|
---|
[551] | 57 | if (hab) {
|
---|
| 58 | hmq = WinCreateMsgQueue(hab, 1024);
|
---|
| 59 | if (hmq) {
|
---|
| 60 | if (InitFM3DLL(hab, argc, argv)) {
|
---|
[1341] | 61 | for (x = 1; x < argc; x++) {
|
---|
| 62 | if (!strchr("/;,`\'", *argv[x]) && !*fullname &&
|
---|
| 63 | (IsRoot(argv[x]) || IsFile(argv[x]) == 0)) {
|
---|
| 64 | if (IsRoot(argv[x]))
|
---|
| 65 | strcpy(fullname, argv[x]);
|
---|
| 66 | else if (DosQueryPathInfo(argv[x],
|
---|
| 67 | FIL_QUERYFULLNAME,
|
---|
| 68 | fullname, sizeof(fullname)))
|
---|
| 69 | *fullname = 0; // Forget name
|
---|
| 70 | }
|
---|
| 71 | }
|
---|
| 72 | hwndFrame = StartSeeAll(HWND_DESKTOP, TRUE, fullname);
|
---|
| 73 | if (hwndFrame) {
|
---|
| 74 | for (;;) {
|
---|
| 75 | if (!WinGetMsg(hab, &qmsg, (HWND) 0, 0, 0)) {
|
---|
| 76 | if (qmsg.hwnd)
|
---|
| 77 | qmsg.msg = WM_CLOSE;
|
---|
| 78 | else
|
---|
| 79 | break;
|
---|
| 80 | }
|
---|
| 81 | if (hwndBubble &&
|
---|
| 82 | ((qmsg.msg > (WM_BUTTON1DOWN - 1) &&
|
---|
| 83 | qmsg.msg < (WM_BUTTON3DBLCLK + 1)) ||
|
---|
| 84 | (qmsg.msg > (WM_CHORD - 1) &&
|
---|
| 85 | qmsg.msg < (WM_BUTTON3CLICK + 1))) &&
|
---|
| 86 | WinIsWindowVisible(hwndBubble))
|
---|
| 87 | WinShowWindow(hwndBubble, FALSE);
|
---|
| 88 | WinDispatchMsg(hab, &qmsg);
|
---|
| 89 | }
|
---|
| 90 | DosSleep(125L);
|
---|
| 91 | }
|
---|
[2] | 92 | }
|
---|
| 93 | DosSleep(125L);
|
---|
| 94 | WinDestroyMsgQueue(hmq);
|
---|
| 95 | }
|
---|
| 96 | WinTerminate(hab);
|
---|
| 97 | }
|
---|
| 98 | return 0;
|
---|
| 99 | }
|
---|