| [907] | 1 | 
 | 
|---|
 | 2 | /***********************************************************************
 | 
|---|
 | 3 | 
 | 
|---|
 | 4 |   $Id: vtree.c 1216 2008-09-13 06:54:29Z jbs $
 | 
|---|
 | 5 | 
 | 
|---|
 | 6 |   Tree viewer applet
 | 
|---|
 | 7 | 
 | 
|---|
 | 8 |   Copyright (c) 1993-98 M. Kimes
 | 
|---|
 | 9 |   Copyright (c) 2008 Steven H.Levine
 | 
|---|
 | 10 | 
 | 
|---|
 | 11 |   05 Jan 08 SHL Sync
 | 
|---|
 | 12 | 
 | 
|---|
 | 13 | ***********************************************************************/
 | 
|---|
 | 14 | 
 | 
|---|
 | 15 | #include <stdlib.h>
 | 
|---|
 | 16 | #include <string.h>
 | 
|---|
 | 17 | 
 | 
|---|
| [2] | 18 | #define INCL_DOS
 | 
|---|
 | 19 | #define INCL_WIN
 | 
|---|
 | 20 | 
 | 
|---|
 | 21 | #include "dll\fm3dll.h"
 | 
|---|
| [1216] | 22 | #include "dll\mainwnd.h"                // Data declaration(s)
 | 
|---|
 | 23 | #include "dll\notebook.h"               // Data declaration(s)
 | 
|---|
| [1176] | 24 | #include "dll\init.h"                   // InitFM3DLL
 | 
|---|
| [1216] | 25 | #include "dll\treecnr.h"                // StartTreeCnr
 | 
|---|
| [2] | 26 | 
 | 
|---|
| [551] | 27 | int main(int argc, char *argv[])
 | 
|---|
 | 28 | {
 | 
|---|
 | 29 |   HAB hab;
 | 
|---|
 | 30 |   HMQ hmq;
 | 
|---|
 | 31 |   QMSG qmsg;
 | 
|---|
 | 32 |   INT x;
 | 
|---|
 | 33 |   BOOL startminimized = FALSE;
 | 
|---|
| [2] | 34 | 
 | 
|---|
| [551] | 35 |   strcpy(appname, "VTREE");
 | 
|---|
| [2] | 36 |   DosError(FERR_DISABLEHARDERR);
 | 
|---|
 | 37 |   hab = WinInitialize(0);
 | 
|---|
| [551] | 38 |   if (hab) {
 | 
|---|
 | 39 |     hmq = WinCreateMsgQueue(hab, 1024);
 | 
|---|
 | 40 |     if (hmq) {
 | 
|---|
 | 41 |       if (InitFM3DLL(hab, argc, argv)) {
 | 
|---|
| [1155] | 42 |         for (x = 1; x < argc; x++) {
 | 
|---|
 | 43 |           if (*argv[x] == '~') {
 | 
|---|
 | 44 |             startminimized = TRUE;
 | 
|---|
 | 45 |             break;
 | 
|---|
 | 46 |           }
 | 
|---|
 | 47 |         }
 | 
|---|
 | 48 |         hwndTree = StartTreeCnr(HWND_DESKTOP, 0);
 | 
|---|
 | 49 |         if (hwndTree) {
 | 
|---|
 | 50 |           if (hwndHelp)
 | 
|---|
 | 51 |             WinAssociateHelpInstance(hwndHelp, hwndTree);
 | 
|---|
 | 52 |           if (!WinRestoreWindowPos("FM/2", "VTreeWindowPos", hwndTree)) {
 | 
|---|
| [2] | 53 | 
 | 
|---|
| [1155] | 54 |             SWP swp;
 | 
|---|
 | 55 |             ULONG adjust;
 | 
|---|
| [2] | 56 | 
 | 
|---|
| [1155] | 57 |             adjust = WinQuerySysValue(HWND_DESKTOP, SV_CXICON) * 8L;
 | 
|---|
 | 58 |             WinQueryTaskSizePos(hab, 0L, &swp);
 | 
|---|
 | 59 |             swp.cx = min(swp.cx, adjust);
 | 
|---|
 | 60 |             WinSetWindowPos(hwndTree, HWND_TOP, swp.x, swp.y, swp.cx, swp.cy,
 | 
|---|
 | 61 |                             SWP_SHOW | SWP_MOVE | SWP_SIZE | SWP_ZORDER |
 | 
|---|
 | 62 |                             SWP_ACTIVATE);
 | 
|---|
 | 63 |           }
 | 
|---|
 | 64 |           if (startminimized)
 | 
|---|
 | 65 |             WinSetWindowPos(hwndTree, HWND_TOP, 0, 0, 0, 0, SWP_MINIMIZE);
 | 
|---|
 | 66 |           else
 | 
|---|
 | 67 |             WinSetWindowPos(hwndTree, HWND_TOP, 0, 0, 0, 0,
 | 
|---|
 | 68 |                             SWP_SHOW | SWP_ZORDER | SWP_ACTIVATE);
 | 
|---|
 | 69 |           for (;;) {
 | 
|---|
 | 70 |             if (!WinGetMsg(hab, &qmsg, (HWND) 0, 0, 0)) {
 | 
|---|
 | 71 |               if (qmsg.hwnd)
 | 
|---|
 | 72 |                 qmsg.msg = WM_CLOSE;
 | 
|---|
 | 73 |               else
 | 
|---|
 | 74 |                 break;
 | 
|---|
 | 75 |             }
 | 
|---|
 | 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 |         }
 | 
|---|
| [2] | 86 |       }
 | 
|---|
| [766] | 87 |       DosSleep(125);
 | 
|---|
| [2] | 88 |       WinDestroyMsgQueue(hmq);
 | 
|---|
 | 89 |     }
 | 
|---|
 | 90 |     WinTerminate(hab);
 | 
|---|
 | 91 |   }
 | 
|---|
 | 92 |   return 0;
 | 
|---|
 | 93 | }
 | 
|---|