| [907] | 1 | 
 | 
|---|
 | 2 | /***********************************************************************
 | 
|---|
 | 3 | 
 | 
|---|
 | 4 |   $Id: vdir.c 907 2008-01-06 07:26:17Z stevenhl $
 | 
|---|
 | 5 | 
 | 
|---|
 | 6 |   INF directory viewer applet
 | 
|---|
 | 7 | 
 | 
|---|
 | 8 |   Copyright (c) 1993-98 M. Kimes
 | 
|---|
 | 9 |   Copyright (c) 2007, 2008 Steven H.Levine
 | 
|---|
 | 10 | 
 | 
|---|
 | 11 |   05 Jan 08 SHL Sync
 | 
|---|
 | 12 | 
 | 
|---|
 | 13 | ***********************************************************************/
 | 
|---|
 | 14 | 
 | 
|---|
 | 15 | #include <string.h>
 | 
|---|
 | 16 | 
 | 
|---|
| [2] | 17 | #define INCL_DOS
 | 
|---|
 | 18 | #define INCL_WIN
 | 
|---|
 | 19 | 
 | 
|---|
 | 20 | #include "dll\fm3dll.h"
 | 
|---|
 | 21 | 
 | 
|---|
| [551] | 22 | int main(int argc, char *argv[])
 | 
|---|
 | 23 | {
 | 
|---|
 | 24 |   HAB hab;
 | 
|---|
 | 25 |   HMQ hmq;
 | 
|---|
 | 26 |   QMSG qmsg;
 | 
|---|
 | 27 |   HWND hwndFrame;
 | 
|---|
 | 28 |   CHAR fullname[CCHMAXPATH], *thisarg = NULL;
 | 
|---|
 | 29 |   INT x;
 | 
|---|
| [2] | 30 | 
 | 
|---|
| [551] | 31 |   strcpy(appname, "VDIR");
 | 
|---|
| [2] | 32 |   DosError(FERR_DISABLEHARDERR);
 | 
|---|
| [551] | 33 |   for (x = 1; x < argc; x++) {
 | 
|---|
 | 34 |     if (!strchr("/;,`\'", *argv[x]) && (IsRoot(argv[x]) || !IsFile(argv[x]))) {
 | 
|---|
| [2] | 35 |       thisarg = argv[x];
 | 
|---|
 | 36 |       break;
 | 
|---|
 | 37 |     }
 | 
|---|
 | 38 |   }
 | 
|---|
 | 39 | 
 | 
|---|
| [551] | 40 |   if (thisarg) {
 | 
|---|
 | 41 |     if (DosQueryPathInfo(thisarg,
 | 
|---|
 | 42 |                          FIL_QUERYFULLNAME, fullname, sizeof(fullname)))
 | 
|---|
 | 43 |       strcpy(fullname, thisarg);
 | 
|---|
| [2] | 44 |   }
 | 
|---|
 | 45 |   else
 | 
|---|
 | 46 |     save_dir(fullname);
 | 
|---|
 | 47 |   hab = WinInitialize(0);
 | 
|---|
| [551] | 48 |   if (hab) {
 | 
|---|
 | 49 |     hmq = WinCreateMsgQueue(hab, 1024);
 | 
|---|
 | 50 |     if (hmq) {
 | 
|---|
 | 51 |       if (InitFM3DLL(hab, argc, argv)) {
 | 
|---|
 | 52 |         hwndFrame = StartDirCnr(HWND_DESKTOP, fullname, (HWND) 0, 0);
 | 
|---|
 | 53 |         if (hwndFrame) {
 | 
|---|
 | 54 |           if (hwndHelp)
 | 
|---|
 | 55 |             WinAssociateHelpInstance(hwndHelp, hwndFrame);
 | 
|---|
 | 56 |           for (;;) {
 | 
|---|
 | 57 |             if (!WinGetMsg(hab, &qmsg, (HWND) 0, 0, 0)) {
 | 
|---|
 | 58 |               if (qmsg.hwnd)
 | 
|---|
 | 59 |                 qmsg.msg = WM_CLOSE;
 | 
|---|
 | 60 |               else
 | 
|---|
 | 61 |                 break;
 | 
|---|
 | 62 |             }
 | 
|---|
 | 63 |             if (hwndBubble &&
 | 
|---|
 | 64 |                 ((qmsg.msg > (WM_BUTTON1DOWN - 1) &&
 | 
|---|
 | 65 |                   qmsg.msg < (WM_BUTTON3DBLCLK + 1)) ||
 | 
|---|
 | 66 |                  (qmsg.msg > (WM_CHORD - 1) &&
 | 
|---|
 | 67 |                   qmsg.msg < (WM_BUTTON3CLICK + 1))) &&
 | 
|---|
 | 68 |                 WinIsWindowVisible(hwndBubble))
 | 
|---|
 | 69 |               WinShowWindow(hwndBubble, FALSE);
 | 
|---|
 | 70 |             WinDispatchMsg(hab, &qmsg);
 | 
|---|
 | 71 |           }
 | 
|---|
 | 72 |         }
 | 
|---|
| [2] | 73 |       }
 | 
|---|
 | 74 |       DosSleep(125L);
 | 
|---|
 | 75 |       WinDestroyMsgQueue(hmq);
 | 
|---|
 | 76 |     }
 | 
|---|
 | 77 |     WinTerminate(hab);
 | 
|---|
 | 78 |   }
 | 
|---|
 | 79 |   return 0;
 | 
|---|
 | 80 | }
 | 
|---|