| 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
 | 
|---|
| 12 |   14 Dec 08 SHL Add exception handler support
 | 
|---|
| 13 | 
 | 
|---|
| 14 | ***********************************************************************/
 | 
|---|
| 15 | 
 | 
|---|
| 16 | #define INCL_DOS
 | 
|---|
| 17 | #define INCL_WIN
 | 
|---|
| 18 | #define INCL_DOSEXCEPTIONS              // XCTP_...
 | 
|---|
| 19 | #define INCL_DOSERRORS                  // NO_ERROR
 | 
|---|
| 20 | 
 | 
|---|
| 21 | #include "dll\fm3dll.h"
 | 
|---|
| 22 | #include "dll\notebook.h"               // hwndHelp
 | 
|---|
| 23 | #include "dll\init.h"                   // InitFM3DLL
 | 
|---|
| 24 | #include "dll\inis.h"                   // StartIniEditor
 | 
|---|
| 25 | #include "dll\errutil.h"                // Error reporting
 | 
|---|
| 26 | #include "dll\excputil.h"               // Exception handlers
 | 
|---|
| 27 | 
 | 
|---|
| 28 | static PSZ pszSrcFile = __FILE__;
 | 
|---|
| 29 | 
 | 
|---|
| 30 | int main(int argc, char *argv[])
 | 
|---|
| 31 | {
 | 
|---|
| 32 |   HAB hab;
 | 
|---|
| 33 |   HMQ hmq;
 | 
|---|
| 34 |   QMSG qmsg;
 | 
|---|
| 35 |   HWND hwndFrame;
 | 
|---|
| 36 |   APIRET regRet;
 | 
|---|
| 37 |   EXCEPTIONREGISTRATIONRECORD regRec = { NULL, NULL };
 | 
|---|
| 38 | 
 | 
|---|
| 39 |   DosError(FERR_DISABLEHARDERR);
 | 
|---|
| 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 | 
 | 
|---|
| 48 |   hab = WinInitialize(0);
 | 
|---|
| 49 |   if (hab) {
 | 
|---|
| 50 |     hmq = WinCreateMsgQueue(hab, 512);
 | 
|---|
| 51 |     if (hmq) {
 | 
|---|
| 52 |       if (InitFM3DLL(hab, argc, argv) &&
 | 
|---|
| 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);
 | 
|---|
| 59 |       }
 | 
|---|
| 60 |       DosSleep(125L);
 | 
|---|
| 61 |       WinDestroyMsgQueue(hmq);
 | 
|---|
| 62 |     }
 | 
|---|
| 63 |     WinTerminate(hab);
 | 
|---|
| 64 |   }
 | 
|---|
| 65 |   return 0;
 | 
|---|
| 66 | }
 | 
|---|