| 1 | 
 | 
|---|
| 2 | /***********************************************************************
 | 
|---|
| 3 | 
 | 
|---|
| 4 |   $Id: vtree.c 1176 2008-09-10 21:52:46Z 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 | 
 | 
|---|
| 18 | #define INCL_DOS
 | 
|---|
| 19 | #define INCL_WIN
 | 
|---|
| 20 | 
 | 
|---|
| 21 | #include "dll\fm3dll.h"
 | 
|---|
| 22 | #include "dll\init.h"                   // InitFM3DLL
 | 
|---|
| 23 | #include "dll\treecnr.h"                        // StartTreeCnr
 | 
|---|
| 24 | 
 | 
|---|
| 25 | int main(int argc, char *argv[])
 | 
|---|
| 26 | {
 | 
|---|
| 27 |   HAB hab;
 | 
|---|
| 28 |   HMQ hmq;
 | 
|---|
| 29 |   QMSG qmsg;
 | 
|---|
| 30 |   INT x;
 | 
|---|
| 31 |   BOOL startminimized = FALSE;
 | 
|---|
| 32 | 
 | 
|---|
| 33 |   strcpy(appname, "VTREE");
 | 
|---|
| 34 |   DosError(FERR_DISABLEHARDERR);
 | 
|---|
| 35 |   hab = WinInitialize(0);
 | 
|---|
| 36 |   if (hab) {
 | 
|---|
| 37 |     hmq = WinCreateMsgQueue(hab, 1024);
 | 
|---|
| 38 |     if (hmq) {
 | 
|---|
| 39 |       if (InitFM3DLL(hab, argc, argv)) {
 | 
|---|
| 40 |         for (x = 1; x < argc; x++) {
 | 
|---|
| 41 |           if (*argv[x] == '~') {
 | 
|---|
| 42 |             startminimized = TRUE;
 | 
|---|
| 43 |             break;
 | 
|---|
| 44 |           }
 | 
|---|
| 45 |         }
 | 
|---|
| 46 |         hwndTree = StartTreeCnr(HWND_DESKTOP, 0);
 | 
|---|
| 47 |         if (hwndTree) {
 | 
|---|
| 48 |           if (hwndHelp)
 | 
|---|
| 49 |             WinAssociateHelpInstance(hwndHelp, hwndTree);
 | 
|---|
| 50 |           if (!WinRestoreWindowPos("FM/2", "VTreeWindowPos", hwndTree)) {
 | 
|---|
| 51 | 
 | 
|---|
| 52 |             SWP swp;
 | 
|---|
| 53 |             ULONG adjust;
 | 
|---|
| 54 | 
 | 
|---|
| 55 |             adjust = WinQuerySysValue(HWND_DESKTOP, SV_CXICON) * 8L;
 | 
|---|
| 56 |             WinQueryTaskSizePos(hab, 0L, &swp);
 | 
|---|
| 57 |             swp.cx = min(swp.cx, adjust);
 | 
|---|
| 58 |             WinSetWindowPos(hwndTree, HWND_TOP, swp.x, swp.y, swp.cx, swp.cy,
 | 
|---|
| 59 |                             SWP_SHOW | SWP_MOVE | SWP_SIZE | SWP_ZORDER |
 | 
|---|
| 60 |                             SWP_ACTIVATE);
 | 
|---|
| 61 |           }
 | 
|---|
| 62 |           if (startminimized)
 | 
|---|
| 63 |             WinSetWindowPos(hwndTree, HWND_TOP, 0, 0, 0, 0, SWP_MINIMIZE);
 | 
|---|
| 64 |           else
 | 
|---|
| 65 |             WinSetWindowPos(hwndTree, HWND_TOP, 0, 0, 0, 0,
 | 
|---|
| 66 |                             SWP_SHOW | SWP_ZORDER | SWP_ACTIVATE);
 | 
|---|
| 67 |           for (;;) {
 | 
|---|
| 68 |             if (!WinGetMsg(hab, &qmsg, (HWND) 0, 0, 0)) {
 | 
|---|
| 69 |               if (qmsg.hwnd)
 | 
|---|
| 70 |                 qmsg.msg = WM_CLOSE;
 | 
|---|
| 71 |               else
 | 
|---|
| 72 |                 break;
 | 
|---|
| 73 |             }
 | 
|---|
| 74 |             if (hwndBubble &&
 | 
|---|
| 75 |                 ((qmsg.msg > (WM_BUTTON1DOWN - 1) &&
 | 
|---|
| 76 |                   qmsg.msg < (WM_BUTTON3DBLCLK + 1)) ||
 | 
|---|
| 77 |                  (qmsg.msg > (WM_CHORD - 1) &&
 | 
|---|
| 78 |                   qmsg.msg < (WM_BUTTON3CLICK + 1))) &&
 | 
|---|
| 79 |                 WinIsWindowVisible(hwndBubble))
 | 
|---|
| 80 |               WinShowWindow(hwndBubble, FALSE);
 | 
|---|
| 81 |             WinDispatchMsg(hab, &qmsg);
 | 
|---|
| 82 |           }
 | 
|---|
| 83 |         }
 | 
|---|
| 84 |       }
 | 
|---|
| 85 |       DosSleep(125);
 | 
|---|
| 86 |       WinDestroyMsgQueue(hmq);
 | 
|---|
| 87 |     }
 | 
|---|
| 88 |     WinTerminate(hab);
 | 
|---|
| 89 |   }
 | 
|---|
| 90 |   return 0;
 | 
|---|
| 91 | }
 | 
|---|