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