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