| 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 | 
|---|
| 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_DOSEXCEPTIONS              // XCTP_... | 
|---|
| 21 | #define INCL_DOSERRORS                  // NO_ERROR | 
|---|
| 22 |  | 
|---|
| 23 | #include "dll\fm3dll.h" | 
|---|
| 24 | #include "dll\fm3dll2.h"                // IDM_GREP | 
|---|
| 25 | #include "dll\mainwnd.h"                // Data declaration(s) | 
|---|
| 26 | #include "dll\notebook.h"               // Data declaration(s) | 
|---|
| 27 | #include "dll\fm3str.h" | 
|---|
| 28 | #include "dll\init.h"                   // InitFM3DLL | 
|---|
| 29 | #include "dll\collect.h"                // StartCollector | 
|---|
| 30 | #include "dll\errutil.h"                // Error reporting | 
|---|
| 31 | #include "dll\excputil.h"               // Exception handlers | 
|---|
| 32 |  | 
|---|
| 33 | static PSZ pszSrcFile = __FILE__; | 
|---|
| 34 |  | 
|---|
| 35 | int main(int argc, char *argv[]) | 
|---|
| 36 | { | 
|---|
| 37 | HAB hab; | 
|---|
| 38 | HMQ hmq; | 
|---|
| 39 | QMSG qmsg; | 
|---|
| 40 | HWND hwndFrame; | 
|---|
| 41 | UINT x; | 
|---|
| 42 | BOOL seekandscan = FALSE; | 
|---|
| 43 | APIRET regRet; | 
|---|
| 44 | EXCEPTIONREGISTRATIONRECORD regRec = { NULL, NULL }; | 
|---|
| 45 |  | 
|---|
| 46 | strcpy(appname, "VCOLLECT"); | 
|---|
| 47 | DosError(FERR_DISABLEHARDERR); | 
|---|
| 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 |  | 
|---|
| 56 | for (x = 1; x < argc; x++) { | 
|---|
| 57 | if (*argv[x] == '*' && argv[x][1] == '*') { | 
|---|
| 58 | seekandscan = TRUE; | 
|---|
| 59 | break; | 
|---|
| 60 | } | 
|---|
| 61 | } | 
|---|
| 62 |  | 
|---|
| 63 | hab = WinInitialize(0); | 
|---|
| 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 | } | 
|---|
| 87 | } | 
|---|
| 88 | DosSleep(125L); | 
|---|
| 89 | WinDestroyMsgQueue(hmq); | 
|---|
| 90 | } | 
|---|
| 91 | WinTerminate(hab); | 
|---|
| 92 | } | 
|---|
| 93 | return 0; | 
|---|
| 94 | } | 
|---|