[907] | 1 |
|
---|
| 2 | /***********************************************************************
|
---|
| 3 |
|
---|
| 4 | $Id: vcollect.c 1341 2008-12-14 22:18:26Z stevenhl $
|
---|
| 5 |
|
---|
| 6 | Collector applet
|
---|
| 7 |
|
---|
| 8 | Copyright (c) 1993-98 M. Kimes
|
---|
| 9 | Copyright (c) 2007, 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 |
|
---|
[1176] | 23 | #include "dll\fm3dll.h"
|
---|
[1341] | 24 | #include "dll\fm3dll2.h" // IDM_GREP
|
---|
[1216] | 25 | #include "dll\mainwnd.h" // Data declaration(s)
|
---|
| 26 | #include "dll\notebook.h" // Data declaration(s)
|
---|
[907] | 27 | #include "dll\fm3str.h"
|
---|
[1176] | 28 | #include "dll\init.h" // InitFM3DLL
|
---|
[1216] | 29 | #include "dll\collect.h" // StartCollector
|
---|
[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 | UINT x;
|
---|
[551] | 42 | BOOL seekandscan = FALSE;
|
---|
[1341] | 43 | APIRET regRet;
|
---|
| 44 | EXCEPTIONREGISTRATIONRECORD regRec = { NULL, NULL };
|
---|
[2] | 45 |
|
---|
[551] | 46 | strcpy(appname, "VCOLLECT");
|
---|
[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 |
|
---|
[551] | 56 | for (x = 1; x < argc; x++) {
|
---|
| 57 | if (*argv[x] == '*' && argv[x][1] == '*') {
|
---|
[2] | 58 | seekandscan = TRUE;
|
---|
| 59 | break;
|
---|
| 60 | }
|
---|
| 61 | }
|
---|
[1341] | 62 |
|
---|
[2] | 63 | hab = WinInitialize(0);
|
---|
[551] | 64 | if (hab) {
|
---|
| 65 | hmq = WinCreateMsgQueue(hab, 1024);
|
---|
| 66 | if (hmq) {
|
---|
| 67 | if (InitFM3DLL(hab, argc, argv)) {
|
---|
| 68 | hwndFrame = StartCollector(HWND_DESKTOP, 0);
|
---|
| 69 | if (hwndFrame) {
|
---|
| 70 | if (hwndHelp)
|
---|
| 71 | WinAssociateHelpInstance(hwndHelp, hwndFrame);
|
---|
| 72 | if (seekandscan)
|
---|
| 73 | WinPostMsg(WinWindowFromID(hwndFrame, FID_CLIENT), WM_COMMAND,
|
---|
| 74 | MPFROM2SHORT(IDM_GREP, 0), MPVOID);
|
---|
| 75 | while (WinGetMsg(hab, &qmsg, (HWND) 0, 0, 0)) {
|
---|
| 76 | if (hwndBubble &&
|
---|
| 77 | ((qmsg.msg > (WM_BUTTON1DOWN - 1) &&
|
---|
| 78 | qmsg.msg < (WM_BUTTON3DBLCLK + 1)) ||
|
---|
| 79 | (qmsg.msg > (WM_CHORD - 1) &&
|
---|
| 80 | qmsg.msg < (WM_BUTTON3CLICK + 1))) &&
|
---|
| 81 | WinIsWindowVisible(hwndBubble))
|
---|
| 82 | WinShowWindow(hwndBubble, FALSE);
|
---|
| 83 | WinDispatchMsg(hab, &qmsg);
|
---|
| 84 | }
|
---|
| 85 | DosSleep(125L);
|
---|
| 86 | }
|
---|
[2] | 87 | }
|
---|
| 88 | DosSleep(125L);
|
---|
| 89 | WinDestroyMsgQueue(hmq);
|
---|
| 90 | }
|
---|
| 91 | WinTerminate(hab);
|
---|
| 92 | }
|
---|
| 93 | return 0;
|
---|
| 94 | }
|
---|