| [907] | 1 |  | 
|---|
|  | 2 | /*********************************************************************** | 
|---|
|  | 3 |  | 
|---|
|  | 4 | $Id: ini.c 1341 2008-12-14 22:18:26Z stevenhl $ | 
|---|
|  | 5 |  | 
|---|
|  | 6 | Ini view/edit 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 |  | 
|---|
| [2] | 16 | #define INCL_DOS | 
|---|
|  | 17 | #define INCL_WIN | 
|---|
| [1341] | 18 | #define INCL_DOSEXCEPTIONS              // XCTP_... | 
|---|
|  | 19 | #define INCL_DOSERRORS                  // NO_ERROR | 
|---|
| [2] | 20 |  | 
|---|
|  | 21 | #include "dll\fm3dll.h" | 
|---|
| [1341] | 22 | #include "dll\notebook.h"               // hwndHelp | 
|---|
| [1176] | 23 | #include "dll\init.h"                   // InitFM3DLL | 
|---|
| [1155] | 24 | #include "dll\inis.h"                   // StartIniEditor | 
|---|
| [1341] | 25 | #include "dll\errutil.h"                // Error reporting | 
|---|
|  | 26 | #include "dll\excputil.h"               // Exception handlers | 
|---|
| [2] | 27 |  | 
|---|
| [1341] | 28 | static PSZ pszSrcFile = __FILE__; | 
|---|
|  | 29 |  | 
|---|
| [551] | 30 | int main(int argc, char *argv[]) | 
|---|
|  | 31 | { | 
|---|
|  | 32 | HAB hab; | 
|---|
|  | 33 | HMQ hmq; | 
|---|
|  | 34 | QMSG qmsg; | 
|---|
|  | 35 | HWND hwndFrame; | 
|---|
| [1341] | 36 | APIRET regRet; | 
|---|
|  | 37 | EXCEPTIONREGISTRATIONRECORD regRec = { NULL, NULL }; | 
|---|
| [2] | 38 |  | 
|---|
|  | 39 | DosError(FERR_DISABLEHARDERR); | 
|---|
| [1341] | 40 |  | 
|---|
|  | 41 | regRec.ExceptionHandler = HandleException; | 
|---|
|  | 42 | regRet = DosSetExceptionHandler(®Rec); | 
|---|
|  | 43 | if (regRet != NO_ERROR) { | 
|---|
|  | 44 | DbgMsg(pszSrcFile, __LINE__, | 
|---|
|  | 45 | "DosSetExceptionHandler failed with error %u", regRet); | 
|---|
|  | 46 | } | 
|---|
|  | 47 |  | 
|---|
| [2] | 48 | hab = WinInitialize(0); | 
|---|
| [551] | 49 | if (hab) { | 
|---|
|  | 50 | hmq = WinCreateMsgQueue(hab, 512); | 
|---|
|  | 51 | if (hmq) { | 
|---|
|  | 52 | if (InitFM3DLL(hab, argc, argv) && | 
|---|
| [1155] | 53 | ((hwndFrame = | 
|---|
|  | 54 | StartIniEditor(HWND_DESKTOP, argv[1], 0)) != (HWND) 0)) { | 
|---|
|  | 55 | if (hwndHelp) | 
|---|
|  | 56 | WinAssociateHelpInstance(hwndHelp, hwndFrame); | 
|---|
|  | 57 | while (WinGetMsg(hab, &qmsg, (HWND) 0, 0, 0)) | 
|---|
|  | 58 | WinDispatchMsg(hab, &qmsg); | 
|---|
| [2] | 59 | } | 
|---|
|  | 60 | DosSleep(125L); | 
|---|
|  | 61 | WinDestroyMsgQueue(hmq); | 
|---|
|  | 62 | } | 
|---|
|  | 63 | WinTerminate(hab); | 
|---|
|  | 64 | } | 
|---|
|  | 65 | return 0; | 
|---|
|  | 66 | } | 
|---|