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