| 1 |
|
|---|
| 2 | /***********************************************************************
|
|---|
| 3 |
|
|---|
| 4 | $Id: vdir.c 1216 2008-09-13 06:54:29Z jbs $
|
|---|
| 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 |
|
|---|
| 17 | #define INCL_DOS
|
|---|
| 18 | #define INCL_WIN
|
|---|
| 19 |
|
|---|
| 20 | #include "dll\fm3dll.h"
|
|---|
| 21 | #include "dll\mainwnd.h" // Data declaration(s)
|
|---|
| 22 | #include "dll\notebook.h" // Data declaration(s)
|
|---|
| 23 | #include "dll\init.h" // InitFM3DLL
|
|---|
| 24 | #include "dll\valid.h" // IsFile
|
|---|
| 25 | #include "dll\dirs.h" // save_dir
|
|---|
| 26 |
|
|---|
| 27 | int main(int argc, char *argv[])
|
|---|
| 28 | {
|
|---|
| 29 | HAB hab;
|
|---|
| 30 | HMQ hmq;
|
|---|
| 31 | QMSG qmsg;
|
|---|
| 32 | HWND hwndFrame;
|
|---|
| 33 | CHAR fullname[CCHMAXPATH], *thisarg = NULL;
|
|---|
| 34 | INT x;
|
|---|
| 35 |
|
|---|
| 36 | strcpy(appname, "VDIR");
|
|---|
| 37 | DosError(FERR_DISABLEHARDERR);
|
|---|
| 38 | for (x = 1; x < argc; x++) {
|
|---|
| 39 | if (!strchr("/;,`\'", *argv[x]) && (IsRoot(argv[x]) || !IsFile(argv[x]))) {
|
|---|
| 40 | thisarg = argv[x];
|
|---|
| 41 | break;
|
|---|
| 42 | }
|
|---|
| 43 | }
|
|---|
| 44 |
|
|---|
| 45 | if (thisarg) {
|
|---|
| 46 | if (DosQueryPathInfo(thisarg,
|
|---|
| 47 | FIL_QUERYFULLNAME, fullname, sizeof(fullname)))
|
|---|
| 48 | strcpy(fullname, thisarg);
|
|---|
| 49 | }
|
|---|
| 50 | else
|
|---|
| 51 | save_dir(fullname);
|
|---|
| 52 | hab = WinInitialize(0);
|
|---|
| 53 | if (hab) {
|
|---|
| 54 | hmq = WinCreateMsgQueue(hab, 1024);
|
|---|
| 55 | if (hmq) {
|
|---|
| 56 | if (InitFM3DLL(hab, argc, argv)) {
|
|---|
| 57 | hwndFrame = StartDirCnr(HWND_DESKTOP, fullname, (HWND) 0, 0);
|
|---|
| 58 | if (hwndFrame) {
|
|---|
| 59 | if (hwndHelp)
|
|---|
| 60 | WinAssociateHelpInstance(hwndHelp, hwndFrame);
|
|---|
| 61 | for (;;) {
|
|---|
| 62 | if (!WinGetMsg(hab, &qmsg, (HWND) 0, 0, 0)) {
|
|---|
| 63 | if (qmsg.hwnd)
|
|---|
| 64 | qmsg.msg = WM_CLOSE;
|
|---|
| 65 | else
|
|---|
| 66 | break;
|
|---|
| 67 | }
|
|---|
| 68 | if (hwndBubble &&
|
|---|
| 69 | ((qmsg.msg > (WM_BUTTON1DOWN - 1) &&
|
|---|
| 70 | qmsg.msg < (WM_BUTTON3DBLCLK + 1)) ||
|
|---|
| 71 | (qmsg.msg > (WM_CHORD - 1) &&
|
|---|
| 72 | qmsg.msg < (WM_BUTTON3CLICK + 1))) &&
|
|---|
| 73 | WinIsWindowVisible(hwndBubble))
|
|---|
| 74 | WinShowWindow(hwndBubble, FALSE);
|
|---|
| 75 | WinDispatchMsg(hab, &qmsg);
|
|---|
| 76 | }
|
|---|
| 77 | }
|
|---|
| 78 | }
|
|---|
| 79 | DosSleep(125L);
|
|---|
| 80 | WinDestroyMsgQueue(hmq);
|
|---|
| 81 | }
|
|---|
| 82 | WinTerminate(hab);
|
|---|
| 83 | }
|
|---|
| 84 | return 0;
|
|---|
| 85 | }
|
|---|