1 |
|
---|
2 | /***********************************************************************
|
---|
3 |
|
---|
4 | $Id: walkem.c 574 2007-03-23 22:37:07Z gyoung $
|
---|
5 |
|
---|
6 | Copyright (c) 1993-98 M. Kimes
|
---|
7 | Copyright (c) 2005, 2007 Steven H. Levine
|
---|
8 |
|
---|
9 | 01 Aug 04 SHL Rework lstrip/rstrip usage
|
---|
10 | 05 Jun 05 SHL Use QWL_USER
|
---|
11 | 13 Aug 05 SHL Run through indent
|
---|
12 | 13 Aug 05 SHL remove_udir - avoid corrupting last dirs list
|
---|
13 | 17 Jul 06 SHL Use Runtime_Error
|
---|
14 | 29 Jul 06 SHL Use xfgets
|
---|
15 | 20 Oct 06 SHL Correct . .. check
|
---|
16 | 06 Nov 06 SHL Oops - need to allow .. here
|
---|
17 | 14 Nov 06 SHL Correct FillPathListBox regression
|
---|
18 | 22 Mar 07 GKY Use QWL_USER
|
---|
19 |
|
---|
20 | ***********************************************************************/
|
---|
21 |
|
---|
22 | #define INCL_WIN
|
---|
23 | #define INCL_DOS
|
---|
24 | #define INCL_DOSERRORS
|
---|
25 | #include <os2.h>
|
---|
26 |
|
---|
27 | #include <stdlib.h>
|
---|
28 | #include <stdio.h>
|
---|
29 | #include <string.h>
|
---|
30 | #include <ctype.h>
|
---|
31 | #include <time.h>
|
---|
32 | #include <share.h>
|
---|
33 |
|
---|
34 | #include "fm3dll.h"
|
---|
35 | #include "fm3dlg.h"
|
---|
36 | #include "fm3str.h"
|
---|
37 |
|
---|
38 | #pragma data_seg(DATA1)
|
---|
39 |
|
---|
40 | static PSZ pszSrcFile = __FILE__;
|
---|
41 |
|
---|
42 | #pragma alloc_text(WALKER,FillPathListBox,WalkDlgProc,TextSubProc)
|
---|
43 | #pragma alloc_text(WALKER,WalkAllDlgProc,WalkCopyDlgProc)
|
---|
44 | #pragma alloc_text(WALKER,WalkMoveDlgProc,WalkExtractDlgProc,WalkTargetDlgProc)
|
---|
45 | #pragma alloc_text(WALK2,WalkTwoDlgProc,WalkTwoCmpDlgProc,WalkTwoSetDlgProc)
|
---|
46 | #pragma alloc_text(UDIRS,add_udir,remove_udir,remove_ldir,load_udirs)
|
---|
47 | #pragma alloc_text(UDIRS,save_udirs,load_setup,save_setup,add_setup)
|
---|
48 | #pragma alloc_text(UDIRS,remove_setup)
|
---|
49 |
|
---|
50 | typedef struct
|
---|
51 | {
|
---|
52 | USHORT size;
|
---|
53 | USHORT changed;
|
---|
54 | BOOL nounwriteable;
|
---|
55 | CHAR szCurrentPath[CCHMAXPATH];
|
---|
56 | CHAR *szReturnPath;
|
---|
57 | }
|
---|
58 | WALKER;
|
---|
59 |
|
---|
60 | static CHAR WalkFont[CCHMAXPATH] = "";
|
---|
61 | static ULONG WalkFontSize = sizeof(WalkFont);
|
---|
62 |
|
---|
63 | VOID load_setups(VOID)
|
---|
64 | {
|
---|
65 | ULONG len = sizeof(lastsetups);
|
---|
66 |
|
---|
67 | memset(lastsetups, 0, len);
|
---|
68 | PrfQueryProfileData(fmprof, FM3Str, "LastSetups", lastsetups, &len);
|
---|
69 | len = sizeof(INT);
|
---|
70 | lastsetup = 0;
|
---|
71 | PrfQueryProfileData(fmprof, FM3Str, "LastSetup", &lastsetup, &len);
|
---|
72 | loadedsetups = TRUE;
|
---|
73 | }
|
---|
74 |
|
---|
75 | VOID save_setups(VOID)
|
---|
76 | {
|
---|
77 | if (!loadedsetups)
|
---|
78 | return;
|
---|
79 | PrfWriteProfileData(fmprof,
|
---|
80 | FM3Str,
|
---|
81 | "LastSetups", lastsetups, (ULONG) sizeof(lastsetups));
|
---|
82 | PrfWriteProfileData(fmprof,
|
---|
83 | FM3Str, "LastSetup", &lastsetup, (ULONG) sizeof(INT));
|
---|
84 | }
|
---|
85 |
|
---|
86 | BOOL add_setup(CHAR * name)
|
---|
87 | {
|
---|
88 | INT x;
|
---|
89 |
|
---|
90 | if (!name || !*name)
|
---|
91 | return FALSE;
|
---|
92 | if (!loadedsetups)
|
---|
93 | load_setups();
|
---|
94 | for (x = 0; x < MAXNUMSETUPS; x++) {
|
---|
95 | if (!stricmp(lastsetups[x], name))
|
---|
96 | return FALSE;
|
---|
97 | }
|
---|
98 | lastsetup++;
|
---|
99 | if (lastsetup >= MAXNUMSETUPS)
|
---|
100 | lastsetup = 0;
|
---|
101 | strcpy(lastsetups[lastsetup], name);
|
---|
102 | return TRUE;
|
---|
103 | }
|
---|
104 |
|
---|
105 | BOOL remove_setup(CHAR * name)
|
---|
106 | {
|
---|
107 | INT x, y;
|
---|
108 |
|
---|
109 | if (!name || !*name)
|
---|
110 | return FALSE;
|
---|
111 | if (!loadedsetups)
|
---|
112 | load_setups();
|
---|
113 | for (x = 0; x < MAXNUMSETUPS; x++) {
|
---|
114 | if (!stricmp(lastsetups[x], name)) {
|
---|
115 | *lastsetups[x] = 0;
|
---|
116 | for (y = x + 1; y < MAXNUMSETUPS; y++)
|
---|
117 | strcpy(lastsetups[y - 1], lastsetups[y]);
|
---|
118 | *lastsetups[MAXNUMSETUPS - 1] = 0;
|
---|
119 | if (lastsetup >= x)
|
---|
120 | lastsetup--;
|
---|
121 | return TRUE;
|
---|
122 | }
|
---|
123 | }
|
---|
124 | return FALSE;
|
---|
125 | }
|
---|
126 |
|
---|
127 | VOID load_udirs(VOID)
|
---|
128 | {
|
---|
129 | /* load linked list of user directories from USERDIRS.DAT file */
|
---|
130 |
|
---|
131 | FILE *fp;
|
---|
132 | LINKDIRS *info;
|
---|
133 | LINKDIRS *last = NULL;
|
---|
134 | CHAR s[CCHMAXPATH + 24];
|
---|
135 |
|
---|
136 | loadedudirs = TRUE;
|
---|
137 | fUdirsChanged = FALSE;
|
---|
138 | save_dir2(s);
|
---|
139 | if (s[strlen(s) - 1] != '\\')
|
---|
140 | strcat(s, "\\");
|
---|
141 | strcat(s, "USERDIRS.DAT");
|
---|
142 | fp = _fsopen(s, "r", SH_DENYWR);
|
---|
143 | if (fp) {
|
---|
144 | while (!feof(fp)) {
|
---|
145 | if (!xfgets(s, CCHMAXPATH + 24, fp, pszSrcFile, __LINE__))
|
---|
146 | break;
|
---|
147 | s[CCHMAXPATH] = 0;
|
---|
148 | bstripcr(s);
|
---|
149 | if (*s && *s != ';') {
|
---|
150 | info = xmalloc(sizeof(LINKDIRS), pszSrcFile, __LINE__);
|
---|
151 | if (info) {
|
---|
152 | info->path = xstrdup(s, pszSrcFile, __LINE__);
|
---|
153 | if (!info->path)
|
---|
154 | free(info);
|
---|
155 | else {
|
---|
156 | info->next = NULL;
|
---|
157 | if (!udirhead)
|
---|
158 | udirhead = info;
|
---|
159 | else
|
---|
160 | last->next = info;
|
---|
161 | last = info;
|
---|
162 | }
|
---|
163 | }
|
---|
164 | }
|
---|
165 | }
|
---|
166 | fclose(fp);
|
---|
167 | }
|
---|
168 | }
|
---|
169 |
|
---|
170 | VOID save_udirs(VOID)
|
---|
171 | {
|
---|
172 | FILE *fp;
|
---|
173 | LINKDIRS *info;
|
---|
174 | CHAR s[CCHMAXPATH + 14];
|
---|
175 |
|
---|
176 | if (loadedudirs) {
|
---|
177 | fUdirsChanged = FALSE;
|
---|
178 | if (udirhead) {
|
---|
179 | save_dir2(s);
|
---|
180 | if (s[strlen(s) - 1] != '\\')
|
---|
181 | strcat(s, "\\");
|
---|
182 | strcat(s, "USERDIRS.DAT");
|
---|
183 | fp = xfopen(s, "w", pszSrcFile, __LINE__);
|
---|
184 | if (fp) {
|
---|
185 | fputs(GetPString(IDS_USERDEFDIRSTEXT), fp);
|
---|
186 | info = udirhead;
|
---|
187 | while (info) {
|
---|
188 | fprintf(fp, "%0.*s\n", CCHMAXPATH, info->path);
|
---|
189 | info = info->next;
|
---|
190 | }
|
---|
191 | fclose(fp);
|
---|
192 | }
|
---|
193 | }
|
---|
194 | }
|
---|
195 | }
|
---|
196 |
|
---|
197 | //=== add_udir - add path to user dir list or last used dir list ===
|
---|
198 |
|
---|
199 | BOOL add_udir(BOOL userdirs, CHAR * inpath)
|
---|
200 | {
|
---|
201 | CHAR path[CCHMAXPATH];
|
---|
202 | LINKDIRS *info;
|
---|
203 | LINKDIRS *last = NULL;
|
---|
204 | LINKDIRS *temp;
|
---|
205 |
|
---|
206 | if (inpath && *inpath) {
|
---|
207 | if (DosQueryPathInfo(inpath, FIL_QUERYFULLNAME, path, sizeof(path)))
|
---|
208 | strcpy(path, inpath);
|
---|
209 | if (!userdirs && IsRoot(path))
|
---|
210 | return FALSE;
|
---|
211 | if (IsFullName(path)) {
|
---|
212 | if (!loadedudirs)
|
---|
213 | load_udirs();
|
---|
214 | // Search user dir list first unless doing last dirs
|
---|
215 | info = userdirs ? udirhead : ldirhead;
|
---|
216 | while (info) {
|
---|
217 | if (!stricmp(info->path, path))
|
---|
218 | return FALSE; // Already in list
|
---|
219 | last = info; // Remember append to location
|
---|
220 | info = info->next;
|
---|
221 | }
|
---|
222 | // Search last dir list unless doing just last dirs
|
---|
223 | if (!userdirs) {
|
---|
224 | info = udirhead;
|
---|
225 | while (info) {
|
---|
226 | if (!stricmp(info->path, path))
|
---|
227 | return FALSE;
|
---|
228 | info = info->next;
|
---|
229 | }
|
---|
230 | }
|
---|
231 | else {
|
---|
232 | /* if adding manual directory, remove from auto list if present */
|
---|
233 | info = ldirhead;
|
---|
234 | temp = NULL;
|
---|
235 | while (info) {
|
---|
236 | if (!stricmp(info->path, path)) {
|
---|
237 | if (temp)
|
---|
238 | temp->next = info->next;
|
---|
239 | else
|
---|
240 | ldirhead = info->next;
|
---|
241 | free(info->path);
|
---|
242 | free(info);
|
---|
243 | break;
|
---|
244 | }
|
---|
245 | temp = info;
|
---|
246 | info = info->next;
|
---|
247 | }
|
---|
248 | }
|
---|
249 | // Append entry to end of user dirs list
|
---|
250 | info = xmalloc(sizeof(LINKDIRS), pszSrcFile, __LINE__);
|
---|
251 | if (info) {
|
---|
252 | info->path = xstrdup(path, pszSrcFile, __LINE__);
|
---|
253 | if (!info->path)
|
---|
254 | free(info);
|
---|
255 | else {
|
---|
256 | info->next = NULL;
|
---|
257 | if (userdirs) {
|
---|
258 | fUdirsChanged = TRUE;
|
---|
259 | if (!udirhead)
|
---|
260 | udirhead = info;
|
---|
261 | else
|
---|
262 | last->next = info;
|
---|
263 | }
|
---|
264 | else {
|
---|
265 | if (!ldirhead)
|
---|
266 | ldirhead = info;
|
---|
267 | else
|
---|
268 | last->next = info;
|
---|
269 | }
|
---|
270 | return TRUE;
|
---|
271 | }
|
---|
272 | }
|
---|
273 | }
|
---|
274 | }
|
---|
275 | return FALSE;
|
---|
276 | }
|
---|
277 |
|
---|
278 | //=== remove_udir - remove path from user dir list or last directory list ===
|
---|
279 |
|
---|
280 | BOOL remove_udir(CHAR * path)
|
---|
281 | {
|
---|
282 | LINKDIRS *info;
|
---|
283 | LINKDIRS *last = NULL;
|
---|
284 |
|
---|
285 | if (path && *path) {
|
---|
286 | if (!loadedudirs)
|
---|
287 | load_udirs();
|
---|
288 | info = udirhead;
|
---|
289 | while (info) {
|
---|
290 | if (!stricmp(info->path, path)) {
|
---|
291 | if (last)
|
---|
292 | last->next = info->next;
|
---|
293 | else
|
---|
294 | udirhead = info->next;
|
---|
295 | free(info->path);
|
---|
296 | free(info);
|
---|
297 | fUdirsChanged = TRUE;
|
---|
298 | return TRUE;
|
---|
299 | }
|
---|
300 | last = info;
|
---|
301 | info = info->next;
|
---|
302 | }
|
---|
303 |
|
---|
304 | info = ldirhead;
|
---|
305 | last = NULL;
|
---|
306 | while (info) {
|
---|
307 | if (!stricmp(info->path, path)) {
|
---|
308 | if (last)
|
---|
309 | last->next = info->next;
|
---|
310 | else
|
---|
311 | ldirhead = info->next;
|
---|
312 | free(info->path);
|
---|
313 | free(info);
|
---|
314 | return TRUE;
|
---|
315 | }
|
---|
316 | last = info;
|
---|
317 | info = info->next;
|
---|
318 | }
|
---|
319 | }
|
---|
320 | return FALSE;
|
---|
321 | }
|
---|
322 |
|
---|
323 | BOOL remove_ldir(CHAR * path)
|
---|
324 | {
|
---|
325 | LINKDIRS *info;
|
---|
326 | LINKDIRS *last = NULL;
|
---|
327 |
|
---|
328 | if (path && *path) {
|
---|
329 | info = ldirhead;
|
---|
330 | while (info) {
|
---|
331 | if (!stricmp(info->path, path)) {
|
---|
332 | if (last)
|
---|
333 | last->next = info->next;
|
---|
334 | else
|
---|
335 | ldirhead = info->next;
|
---|
336 | free(info->path);
|
---|
337 | free(info);
|
---|
338 | return TRUE;
|
---|
339 | }
|
---|
340 | last = info;
|
---|
341 | info = info->next;
|
---|
342 | }
|
---|
343 | }
|
---|
344 | return FALSE;
|
---|
345 | }
|
---|
346 |
|
---|
347 | VOID FillPathListBox(HWND hwnd, HWND hwnddrive, HWND hwnddir, CHAR * pszPath,
|
---|
348 | BOOL nounwriteable)
|
---|
349 | {
|
---|
350 | /*
|
---|
351 | * this function fills one or two list boxes with drive and directory
|
---|
352 | * information showing all available drives and all directories off of
|
---|
353 | * the directory represented by path. This works independently of the
|
---|
354 | * current directory.
|
---|
355 | */
|
---|
356 |
|
---|
357 | CHAR szDrive[] = " :", szTemp[1032];
|
---|
358 | FILEFINDBUF3 findbuf;
|
---|
359 | HDIR hDir = HDIR_CREATE;
|
---|
360 | SHORT sDrive;
|
---|
361 | ULONG ulDriveNum, ulSearchCount = 1L, ulDriveMap;
|
---|
362 |
|
---|
363 | DosError(FERR_DISABLEHARDERR);
|
---|
364 | DosQCurDisk(&ulDriveNum, &ulDriveMap);
|
---|
365 | if (hwnddrive)
|
---|
366 | WinSendMsg(hwnddrive, LM_DELETEALL, MPVOID, MPVOID);
|
---|
367 | if (hwnddrive != hwnddir && hwnddir)
|
---|
368 | WinSendMsg(hwnddir, LM_DELETEALL, MPVOID, MPVOID);
|
---|
369 |
|
---|
370 | if (hwnddrive) {
|
---|
371 | // Fill drive listbox
|
---|
372 | for (sDrive = 0; sDrive < 26; sDrive++) {
|
---|
373 | if (ulDriveMap & (1L << sDrive)) {
|
---|
374 | *szDrive = (CHAR) (sDrive + 'A');
|
---|
375 | if ((!nounwriteable || !(driveflags[sDrive] & DRIVE_NOTWRITEABLE)) &&
|
---|
376 | !(driveflags[sDrive] & (DRIVE_IGNORE | DRIVE_INVALID)))
|
---|
377 | WinSendMsg(hwnddrive, LM_INSERTITEM, MPFROM2SHORT(LIT_END, 0),
|
---|
378 | MPFROMP(szDrive));
|
---|
379 | }
|
---|
380 | }
|
---|
381 | if (hwnddrive != hwnddir && pszPath && isalpha(*pszPath)
|
---|
382 | && pszPath[1] == ':') {
|
---|
383 | *szDrive = toupper(*pszPath);
|
---|
384 | WinSetWindowText(hwnddrive, szDrive);
|
---|
385 | }
|
---|
386 | }
|
---|
387 |
|
---|
388 | if (hwnddir) {
|
---|
389 | // Fill directory listbox
|
---|
390 | sprintf(szTemp,
|
---|
391 | "%s%s*",
|
---|
392 | pszPath, (pszPath[strlen(pszPath) - 1] == '\\') ? "" : "\\");
|
---|
393 | DosError(FERR_DISABLEHARDERR);
|
---|
394 | if (!DosFindFirst(szTemp,
|
---|
395 | &hDir,
|
---|
396 | FILE_DIRECTORY | MUST_HAVE_DIRECTORY |
|
---|
397 | FILE_READONLY | FILE_ARCHIVED | FILE_SYSTEM |
|
---|
398 | FILE_HIDDEN,
|
---|
399 | &findbuf,
|
---|
400 | sizeof(FILEFINDBUF3), &ulSearchCount, FIL_STANDARD)) {
|
---|
401 | do {
|
---|
402 | if (findbuf.attrFile & FILE_DIRECTORY) {
|
---|
403 | // Skip .. unless full path supplied
|
---|
404 | if (strcmp(findbuf.achName, "..") ||
|
---|
405 | strlen(pszPath) > 3 || pszPath[1] != ':') {
|
---|
406 | // Skip . allow ..
|
---|
407 | if (findbuf.achName[0] != '.' || findbuf.achName[1]) {
|
---|
408 | WinSendMsg(hwnddir,
|
---|
409 | LM_INSERTITEM,
|
---|
410 | MPFROM2SHORT(LIT_SORTASCENDING, 0),
|
---|
411 | MPFROMP(findbuf.achName));
|
---|
412 | }
|
---|
413 | }
|
---|
414 | }
|
---|
415 | ulSearchCount = 1L;
|
---|
416 | } while (!DosFindNext(hDir,
|
---|
417 | &findbuf, sizeof(FILEFINDBUF3), &ulSearchCount));
|
---|
418 | DosFindClose(hDir);
|
---|
419 | }
|
---|
420 | DosError(FERR_DISABLEHARDERR);
|
---|
421 | }
|
---|
422 | }
|
---|
423 |
|
---|
424 | MRESULT EXPENTRY TextSubProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
---|
425 | {
|
---|
426 | PFNWP oldproc = (PFNWP) WinQueryWindowPtr(hwnd, QWL_USER);
|
---|
427 |
|
---|
428 | switch (msg) {
|
---|
429 | case WM_CHAR:
|
---|
430 | if (SHORT1FROMMP(mp1) & KC_KEYUP) {
|
---|
431 | if ((SHORT1FROMMP(mp1) & KC_VIRTUALKEY) &&
|
---|
432 | (SHORT1FROMMP(mp2) & 255) == '\r')
|
---|
433 | PostMsg(WinQueryWindow(hwnd, QW_PARENT), WM_COMMAND,
|
---|
434 | MPFROM2SHORT(DID_OK, 0), MPVOID);
|
---|
435 | }
|
---|
436 | break;
|
---|
437 | }
|
---|
438 | return oldproc(hwnd, msg, mp1, mp2);
|
---|
439 | }
|
---|
440 |
|
---|
441 | MRESULT EXPENTRY WalkDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
---|
442 | {
|
---|
443 | WALKER *wa;
|
---|
444 | CHAR szBuff[CCHMAXPATH + 1], szBuffer[CCHMAXPATH + 1], *p;
|
---|
445 | SHORT sSelect;
|
---|
446 | static BOOL okay; /* avoid combobox selecting as filled */
|
---|
447 | static CHAR lastdir[CCHMAXPATH + 1];
|
---|
448 |
|
---|
449 | switch (msg) {
|
---|
450 | case UM_SETUP2:
|
---|
451 | case WM_INITDLG:
|
---|
452 | okay = FALSE;
|
---|
453 | *lastdir = 0;
|
---|
454 | if (!mp2) {
|
---|
455 | Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
|
---|
456 | WinDismissDlg(hwnd, 0);
|
---|
457 | break;
|
---|
458 | }
|
---|
459 | wa = xmallocz(sizeof(WALKER), pszSrcFile, __LINE__);
|
---|
460 | if (!wa) {
|
---|
461 | WinDismissDlg(hwnd, 0);
|
---|
462 | break;
|
---|
463 | }
|
---|
464 | wa->size = (USHORT) sizeof(WALKER);
|
---|
465 | WinSetWindowPtr(hwnd, QWL_USER, (PVOID) wa);
|
---|
466 | wa->szReturnPath = (CHAR *) mp2;
|
---|
467 | {
|
---|
468 | PFNWP oldproc;
|
---|
469 |
|
---|
470 | oldproc = WinSubclassWindow(WinWindowFromID(hwnd, WALK_PATH),
|
---|
471 | (PFNWP) TextSubProc);
|
---|
472 | if (oldproc)
|
---|
473 | WinSetWindowPtr(WinWindowFromID(hwnd, WALK_PATH),
|
---|
474 | QWL_USER, (PVOID) oldproc);
|
---|
475 | WinSendDlgItemMsg(WinWindowFromID(hwnd, WALK_RECENT),
|
---|
476 | CBID_EDIT,
|
---|
477 | EM_SETTEXTLIMIT, MPFROM2SHORT(CCHMAXPATH, 0), MPVOID);
|
---|
478 | WinSendDlgItemMsg(WinWindowFromID(hwnd, WALK_RECENT),
|
---|
479 | CBID_EDIT,
|
---|
480 | EM_SETREADONLY, MPFROM2SHORT(TRUE, 0), MPVOID);
|
---|
481 | }
|
---|
482 | PosOverOkay(hwnd);
|
---|
483 | if (msg == UM_SETUP2)
|
---|
484 | wa->nounwriteable = FALSE;
|
---|
485 | else
|
---|
486 | wa->nounwriteable = TRUE;
|
---|
487 | if (!*wa->szReturnPath)
|
---|
488 | save_dir2(wa->szCurrentPath);
|
---|
489 | else {
|
---|
490 | strcpy(wa->szCurrentPath, wa->szReturnPath);
|
---|
491 | MakeFullName(wa->szCurrentPath);
|
---|
492 | }
|
---|
493 | if (wa->nounwriteable &&
|
---|
494 | (driveflags[toupper(*wa->szCurrentPath) - 'A'] &
|
---|
495 | DRIVE_NOTWRITEABLE)) {
|
---|
496 |
|
---|
497 | ULONG bd;
|
---|
498 |
|
---|
499 | strcpy(wa->szCurrentPath, "C:\\");
|
---|
500 | if (DosQuerySysInfo(QSV_BOOT_DRIVE,
|
---|
501 | QSV_BOOT_DRIVE,
|
---|
502 | (PVOID) & bd, (ULONG) sizeof(ULONG)))
|
---|
503 | bd = 3L;
|
---|
504 | *wa->szCurrentPath = (CHAR) bd + '@';
|
---|
505 | }
|
---|
506 | WinSendDlgItemMsg(hwnd,
|
---|
507 | WALK_PATH,
|
---|
508 | EM_SETTEXTLIMIT, MPFROM2SHORT(CCHMAXPATH, 0), MPVOID);
|
---|
509 | WinSetDlgItemText(hwnd, WALK_PATH, wa->szCurrentPath);
|
---|
510 | if (!loadedudirs)
|
---|
511 | load_udirs();
|
---|
512 | { /* fill user list box */
|
---|
513 | ULONG ulDriveNum, ulDriveMap;
|
---|
514 | ULONG ulSearchCount;
|
---|
515 | FILEFINDBUF3 findbuf;
|
---|
516 | HDIR hDir;
|
---|
517 | APIRET rc;
|
---|
518 | LINKDIRS *info, *temp;
|
---|
519 |
|
---|
520 | DosError(FERR_DISABLEHARDERR);
|
---|
521 | DosQCurDisk(&ulDriveNum, &ulDriveMap);
|
---|
522 | info = udirhead;
|
---|
523 | while (info) {
|
---|
524 | if (IsFullName(info->path) &&
|
---|
525 | !(driveflags[toupper(*info->path) - 'A'] &
|
---|
526 | (DRIVE_IGNORE | DRIVE_INVALID))) {
|
---|
527 | DosError(FERR_DISABLEHARDERR);
|
---|
528 | hDir = HDIR_CREATE;
|
---|
529 | ulSearchCount = 1L;
|
---|
530 | if (!IsRoot(info->path))
|
---|
531 | rc = DosFindFirst(info->path, &hDir, FILE_DIRECTORY |
|
---|
532 | MUST_HAVE_DIRECTORY | FILE_READONLY |
|
---|
533 | FILE_ARCHIVED | FILE_SYSTEM | FILE_HIDDEN,
|
---|
534 | &findbuf, sizeof(FILEFINDBUF3),
|
---|
535 | &ulSearchCount, FIL_STANDARD);
|
---|
536 | else {
|
---|
537 | rc = 0;
|
---|
538 | findbuf.attrFile = FILE_DIRECTORY;
|
---|
539 | }
|
---|
540 | if (!rc) {
|
---|
541 | if (!IsRoot(info->path))
|
---|
542 | DosFindClose(hDir);
|
---|
543 | if (findbuf.attrFile & FILE_DIRECTORY)
|
---|
544 | WinSendDlgItemMsg(hwnd, WALK_USERLIST, LM_INSERTITEM,
|
---|
545 | MPFROM2SHORT(LIT_SORTASCENDING, 0),
|
---|
546 | MPFROMP(info->path));
|
---|
547 | else {
|
---|
548 | temp = info->next;
|
---|
549 | remove_udir(info->path);
|
---|
550 | info = temp;
|
---|
551 | continue;
|
---|
552 | }
|
---|
553 | }
|
---|
554 | else if (!(ulDriveMap & (1L << (toupper(*info->path) - 'A')))) {
|
---|
555 | temp = info->next;
|
---|
556 | remove_udir(info->path);
|
---|
557 | info = temp;
|
---|
558 | continue;
|
---|
559 | }
|
---|
560 | }
|
---|
561 | info = info->next;
|
---|
562 | }
|
---|
563 | info = ldirhead;
|
---|
564 | while (info) {
|
---|
565 | if (IsFullName(info->path) &&
|
---|
566 | !(driveflags[toupper(*info->path) - 'A'] &
|
---|
567 | (DRIVE_IGNORE | DRIVE_INVALID))) {
|
---|
568 | DosError(FERR_DISABLEHARDERR);
|
---|
569 | hDir = HDIR_CREATE;
|
---|
570 | ulSearchCount = 1L;
|
---|
571 | if (!IsRoot(info->path))
|
---|
572 | rc = DosFindFirst(info->path, &hDir, FILE_DIRECTORY |
|
---|
573 | MUST_HAVE_DIRECTORY | FILE_READONLY |
|
---|
574 | FILE_ARCHIVED | FILE_SYSTEM | FILE_HIDDEN,
|
---|
575 | &findbuf, sizeof(FILEFINDBUF3),
|
---|
576 | &ulSearchCount, FIL_STANDARD);
|
---|
577 | else {
|
---|
578 | rc = 0;
|
---|
579 | findbuf.attrFile = FILE_DIRECTORY;
|
---|
580 | }
|
---|
581 | if (!rc) {
|
---|
582 | if (!IsRoot(info->path))
|
---|
583 | DosFindClose(hDir);
|
---|
584 | if (findbuf.attrFile & FILE_DIRECTORY)
|
---|
585 | WinSendDlgItemMsg(hwnd, WALK_RECENT, LM_INSERTITEM,
|
---|
586 | MPFROM2SHORT(LIT_SORTASCENDING, 0),
|
---|
587 | MPFROMP(info->path));
|
---|
588 | else {
|
---|
589 | temp = info->next;
|
---|
590 | remove_ldir(info->path);
|
---|
591 | info = temp;
|
---|
592 | continue;
|
---|
593 | }
|
---|
594 | WinSetDlgItemText(hwnd, WALK_RECENT,
|
---|
595 | GetPString(IDS_WALKRECENTDIRSTEXT));
|
---|
596 | }
|
---|
597 | else if (!(ulDriveMap & (1L << (toupper(*info->path) - 'A')))) {
|
---|
598 | temp = info->next;
|
---|
599 | remove_ldir(info->path);
|
---|
600 | info = temp;
|
---|
601 | continue;
|
---|
602 | }
|
---|
603 | }
|
---|
604 | info = info->next;
|
---|
605 | }
|
---|
606 | }
|
---|
607 | FillPathListBox(hwnd,
|
---|
608 | WinWindowFromID(hwnd, WALK_DRIVELIST),
|
---|
609 | WinWindowFromID(hwnd, WALK_DIRLIST),
|
---|
610 | wa->szCurrentPath, wa->nounwriteable);
|
---|
611 | if (!PostMsg(hwnd, UM_SETUP4, MPVOID, MPVOID))
|
---|
612 | okay = TRUE;
|
---|
613 | {
|
---|
614 | MRESULT ret;
|
---|
615 |
|
---|
616 | ret = WinDefDlgProc(hwnd, WM_INITDLG, mp1, mp2);
|
---|
617 | WinSendMsg(hwnd, UM_SETUP, MPVOID, MPVOID);
|
---|
618 | WinInvalidateRect(WinWindowFromID(hwnd, WALK_PATH), NULL, TRUE);
|
---|
619 | return ret;
|
---|
620 | }
|
---|
621 |
|
---|
622 | case UM_SETUP4:
|
---|
623 | okay = TRUE;
|
---|
624 | return 0;
|
---|
625 |
|
---|
626 | case WM_ADJUSTWINDOWPOS:
|
---|
627 | PostMsg(hwnd, UM_SETDIR, MPVOID, MPVOID);
|
---|
628 | break;
|
---|
629 |
|
---|
630 | case UM_SETDIR:
|
---|
631 | PaintRecessedWindow(WinWindowFromID(hwnd, WALK_HELP), (HPS) 0, FALSE,
|
---|
632 | TRUE);
|
---|
633 | return 0;
|
---|
634 |
|
---|
635 | case WM_PRESPARAMCHANGED:
|
---|
636 | {
|
---|
637 | ULONG AttrFound, AttrValue[64], cbRetLen;
|
---|
638 |
|
---|
639 | cbRetLen = WinQueryPresParam(hwnd, (ULONG) mp1, 0, &AttrFound,
|
---|
640 | (ULONG) sizeof(AttrValue), &AttrValue, 0);
|
---|
641 | if (cbRetLen) {
|
---|
642 | switch (AttrFound) {
|
---|
643 | case PP_FONTNAMESIZE:
|
---|
644 | PrfWriteProfileData(fmprof,
|
---|
645 | appname,
|
---|
646 | "WalkFont", (PVOID) AttrValue, cbRetLen);
|
---|
647 | *WalkFont = 0;
|
---|
648 | WalkFontSize = sizeof(WalkFont);
|
---|
649 | WinInvalidateRect(WinWindowFromID(hwnd, WALK_PATH), NULL, TRUE);
|
---|
650 | break;
|
---|
651 | }
|
---|
652 | }
|
---|
653 | }
|
---|
654 | break;
|
---|
655 |
|
---|
656 | case UM_SETUP3:
|
---|
657 | save_udirs();
|
---|
658 | if (hwndMain)
|
---|
659 | PostMsg(hwndMain, UM_FILLUSERLIST, MPVOID, MPVOID);
|
---|
660 | return 0;
|
---|
661 |
|
---|
662 | case UM_SETUP:
|
---|
663 | {
|
---|
664 | INT x;
|
---|
665 | USHORT id[] = { WALK_PATH, WALK_DIRLIST, WALK_USERLIST,
|
---|
666 | WALK_RECENT, 0
|
---|
667 | };
|
---|
668 |
|
---|
669 | if (*WalkFont ||
|
---|
670 | (PrfQueryProfileData(fmprof,
|
---|
671 | appname,
|
---|
672 | "WalkFont",
|
---|
673 | (PVOID) WalkFont,
|
---|
674 | &WalkFontSize) && WalkFontSize)) {
|
---|
675 | for (x = 0; id[x]; x++)
|
---|
676 | WinSetPresParam(WinWindowFromID(hwnd, id[x]),
|
---|
677 | PP_FONTNAMESIZE, WalkFontSize, (PVOID) WalkFont);
|
---|
678 | }
|
---|
679 | }
|
---|
680 | return 0;
|
---|
681 |
|
---|
682 | case UM_CONTROL:
|
---|
683 | case WM_CONTROL:
|
---|
684 | wa = WinQueryWindowPtr(hwnd, QWL_USER);
|
---|
685 | if (SHORT1FROMMP(mp1) == WALK_DRIVELIST ||
|
---|
686 | SHORT1FROMMP(mp1) == WALK_DIRLIST ||
|
---|
687 | SHORT1FROMMP(mp1) == WALK_USERLIST ||
|
---|
688 | SHORT1FROMMP(mp1) == WALK_RECENT) {
|
---|
689 | sSelect = (USHORT) WinSendDlgItemMsg(hwnd,
|
---|
690 | SHORT1FROMMP(mp1),
|
---|
691 | LM_QUERYSELECTION, MPVOID, MPVOID);
|
---|
692 | *szBuffer = 0;
|
---|
693 | if (sSelect >= 0)
|
---|
694 | WinSendDlgItemMsg(hwnd, SHORT1FROMMP(mp1), LM_QUERYITEMTEXT,
|
---|
695 | MPFROM2SHORT(sSelect, CCHMAXPATH),
|
---|
696 | MPFROMP(szBuffer));
|
---|
697 | }
|
---|
698 | switch (SHORT1FROMMP(mp1)) {
|
---|
699 | case WALK_PATH:
|
---|
700 | if (SHORT2FROMMP(mp1) == EN_SETFOCUS)
|
---|
701 | WinSetDlgItemText(hwnd, WALK_HELP, GetPString(IDS_WALKCURRDIRTEXT));
|
---|
702 | else if (SHORT2FROMMP(mp1) == EN_KILLFOCUS)
|
---|
703 | WinSetDlgItemText(hwnd, WALK_HELP,
|
---|
704 | GetPString(IDS_WALKDEFAULTHELPTEXT));
|
---|
705 | break;
|
---|
706 |
|
---|
707 | case WALK_RECENT:
|
---|
708 | if (okay && SHORT2FROMMP(mp1) == CBN_LBSELECT) {
|
---|
709 |
|
---|
710 | ULONG ulSearchCount;
|
---|
711 | FILEFINDBUF3 findbuf;
|
---|
712 | HDIR hDir;
|
---|
713 | APIRET rc;
|
---|
714 |
|
---|
715 | // *szBuffer = 0;
|
---|
716 | // WinQueryDlgItemText(hwnd,WALK_RECENT,CCHMAXPATH,szBuffer);
|
---|
717 | if (!*szBuffer)
|
---|
718 | break;
|
---|
719 | DosError(FERR_DISABLEHARDERR);
|
---|
720 | hDir = HDIR_CREATE;
|
---|
721 | ulSearchCount = 1L;
|
---|
722 | if (!IsRoot(szBuffer)) {
|
---|
723 | rc = DosFindFirst(szBuffer, &hDir, FILE_DIRECTORY |
|
---|
724 | MUST_HAVE_DIRECTORY | FILE_READONLY |
|
---|
725 | FILE_ARCHIVED | FILE_SYSTEM | FILE_HIDDEN,
|
---|
726 | &findbuf, sizeof(FILEFINDBUF3),
|
---|
727 | &ulSearchCount, FIL_STANDARD);
|
---|
728 | if (!rc)
|
---|
729 | DosFindClose(hDir);
|
---|
730 | }
|
---|
731 | else {
|
---|
732 | findbuf.attrFile = FILE_DIRECTORY;
|
---|
733 | rc = 0;
|
---|
734 | }
|
---|
735 | if (rc)
|
---|
736 | Dos_Error(MB_CANCEL, rc, hwnd, pszSrcFile, __LINE__,
|
---|
737 | "DosFindFirst");
|
---|
738 | else if (~findbuf.attrFile & FILE_DIRECTORY)
|
---|
739 | Runtime_Error(pszSrcFile, __LINE__, "not a directory");
|
---|
740 | else {
|
---|
741 | strcpy(wa->szCurrentPath, szBuffer);
|
---|
742 | WinSetDlgItemText(hwnd, WALK_PATH, wa->szCurrentPath);
|
---|
743 | WinSetDlgItemText(hwnd, WALK_RECENT, wa->szCurrentPath);
|
---|
744 | FillPathListBox(hwnd,
|
---|
745 | WinWindowFromID(hwnd, WALK_DRIVELIST),
|
---|
746 | WinWindowFromID(hwnd, WALK_DIRLIST),
|
---|
747 | wa->szCurrentPath, FALSE);
|
---|
748 | }
|
---|
749 | }
|
---|
750 | else if (SHORT2FROMMP(mp1) == CBN_ENTER)
|
---|
751 | PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(DID_OK, 0), MPVOID);
|
---|
752 | else if (SHORT2FROMMP(mp1) == CBN_SHOWLIST)
|
---|
753 | WinSetDlgItemText(hwnd, WALK_HELP,
|
---|
754 | GetPString(IDS_WALKRECENTDIRSHELPTEXT));
|
---|
755 | break;
|
---|
756 |
|
---|
757 | case WALK_USERLIST:
|
---|
758 | if (okay && *szBuffer && SHORT2FROMMP(mp1) == LN_SELECT) {
|
---|
759 |
|
---|
760 | ULONG ulSearchCount;
|
---|
761 | FILEFINDBUF3 findbuf;
|
---|
762 | HDIR hDir;
|
---|
763 | APIRET rc;
|
---|
764 |
|
---|
765 | DosError(FERR_DISABLEHARDERR);
|
---|
766 | hDir = HDIR_CREATE;
|
---|
767 | ulSearchCount = 1L;
|
---|
768 | if (!IsRoot(szBuffer)) {
|
---|
769 | rc = DosFindFirst(szBuffer,
|
---|
770 | &hDir,
|
---|
771 | FILE_DIRECTORY |
|
---|
772 | MUST_HAVE_DIRECTORY | FILE_READONLY |
|
---|
773 | FILE_ARCHIVED | FILE_SYSTEM | FILE_HIDDEN,
|
---|
774 | &findbuf,
|
---|
775 | sizeof(FILEFINDBUF3),
|
---|
776 | &ulSearchCount, FIL_STANDARD);
|
---|
777 | if (!rc)
|
---|
778 | DosFindClose(hDir);
|
---|
779 | }
|
---|
780 | else {
|
---|
781 | findbuf.attrFile = FILE_DIRECTORY;
|
---|
782 | rc = 0;
|
---|
783 | }
|
---|
784 | if (rc)
|
---|
785 | Dos_Error(MB_CANCEL, rc, hwnd, pszSrcFile, __LINE__,
|
---|
786 | "DosFindFirst");
|
---|
787 | else if (~findbuf.attrFile & FILE_DIRECTORY)
|
---|
788 | Runtime_Error(pszSrcFile, __LINE__, "not a directory");
|
---|
789 | else {
|
---|
790 | strcpy(wa->szCurrentPath, szBuffer);
|
---|
791 | WinSetDlgItemText(hwnd, WALK_PATH, wa->szCurrentPath);
|
---|
792 | FillPathListBox(hwnd,
|
---|
793 | WinWindowFromID(hwnd, WALK_DRIVELIST),
|
---|
794 | WinWindowFromID(hwnd, WALK_DIRLIST),
|
---|
795 | wa->szCurrentPath, FALSE);
|
---|
796 | }
|
---|
797 | }
|
---|
798 | else if (SHORT2FROMMP(mp1) == LN_ENTER)
|
---|
799 | PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(DID_OK, 0), MPVOID);
|
---|
800 | else if (SHORT2FROMMP(mp1) == LN_SETFOCUS)
|
---|
801 | WinSetDlgItemText(hwnd,
|
---|
802 | WALK_HELP, GetPString(IDS_WALKUSERDIRSHELPTEXT));
|
---|
803 | else if (SHORT2FROMMP(mp1) == LN_KILLFOCUS)
|
---|
804 | WinSetDlgItemText(hwnd,
|
---|
805 | WALK_HELP, GetPString(IDS_WALKDEFAULTHELPTEXT));
|
---|
806 | break;
|
---|
807 |
|
---|
808 | case WALK_DRIVELIST:
|
---|
809 | if (okay && *szBuffer && SHORT2FROMMP(mp1) == LN_ENTER) {
|
---|
810 |
|
---|
811 | ULONG ulDirLen = CCHMAXPATH;
|
---|
812 | APIRET rc;
|
---|
813 |
|
---|
814 | rc = DosQCurDir(toupper(*szBuffer) - '@', &szBuff[3], &ulDirLen);
|
---|
815 | if (!rc) {
|
---|
816 | strcpy(wa->szCurrentPath, "C:\\");
|
---|
817 | *wa->szCurrentPath = toupper(*szBuffer);
|
---|
818 | WinSetDlgItemText(hwnd, WALK_PATH, wa->szCurrentPath);
|
---|
819 | FillPathListBox(hwnd,
|
---|
820 | WinWindowFromID(hwnd, WALK_DRIVELIST),
|
---|
821 | WinWindowFromID(hwnd, WALK_DIRLIST),
|
---|
822 | wa->szCurrentPath, FALSE);
|
---|
823 | }
|
---|
824 | }
|
---|
825 | else if (SHORT2FROMMP(mp1) == LN_SETFOCUS)
|
---|
826 | WinSetDlgItemText(hwnd, WALK_HELP,
|
---|
827 | GetPString(IDS_WALKDRIVELISTHELPTEXT));
|
---|
828 | else if (SHORT2FROMMP(mp1) == LN_KILLFOCUS)
|
---|
829 | WinSetDlgItemText(hwnd, WALK_HELP,
|
---|
830 | GetPString(IDS_WALKDEFAULTHELPTEXT));
|
---|
831 | break;
|
---|
832 |
|
---|
833 | case WALK_DIRLIST:
|
---|
834 | if (okay && SHORT2FROMMP(mp1) == LN_ENTER) {
|
---|
835 |
|
---|
836 | ULONG ulSearchCount;
|
---|
837 | FILEFINDBUF3 findbuf;
|
---|
838 | HDIR hDir;
|
---|
839 | APIRET rc;
|
---|
840 |
|
---|
841 | bstrip(szBuffer);
|
---|
842 | if (*szBuffer) {
|
---|
843 | strcpy(szBuff, wa->szCurrentPath);
|
---|
844 | if (szBuff[strlen(szBuff) - 1] != '\\')
|
---|
845 | strcat(szBuff, "\\");
|
---|
846 | strcat(szBuff, szBuffer);
|
---|
847 | MakeFullName(szBuff);
|
---|
848 | DosError(FERR_DISABLEHARDERR);
|
---|
849 | hDir = HDIR_CREATE;
|
---|
850 | ulSearchCount = 1L;
|
---|
851 | if (!IsRoot(szBuff)) {
|
---|
852 | rc = DosFindFirst(szBuff,
|
---|
853 | &hDir,
|
---|
854 | FILE_DIRECTORY |
|
---|
855 | MUST_HAVE_DIRECTORY | FILE_READONLY |
|
---|
856 | FILE_ARCHIVED | FILE_SYSTEM | FILE_HIDDEN,
|
---|
857 | &findbuf,
|
---|
858 | sizeof(FILEFINDBUF3),
|
---|
859 | &ulSearchCount, FIL_STANDARD);
|
---|
860 | if (!rc)
|
---|
861 | DosFindClose(hDir);
|
---|
862 | }
|
---|
863 | else {
|
---|
864 | findbuf.attrFile = FILE_DIRECTORY;
|
---|
865 | rc = 0;
|
---|
866 | }
|
---|
867 | if (!rc && (findbuf.attrFile & FILE_DIRECTORY)) {
|
---|
868 | strcpy(wa->szCurrentPath, szBuff);
|
---|
869 | WinSetDlgItemText(hwnd, WALK_PATH, wa->szCurrentPath);
|
---|
870 | FillPathListBox(hwnd,
|
---|
871 | WinWindowFromID(hwnd, WALK_DRIVELIST),
|
---|
872 | WinWindowFromID(hwnd, WALK_DIRLIST),
|
---|
873 | wa->szCurrentPath, FALSE);
|
---|
874 | }
|
---|
875 | }
|
---|
876 | }
|
---|
877 | else if (SHORT2FROMMP(mp1) == LN_SETFOCUS)
|
---|
878 | WinSetDlgItemText(hwnd, WALK_HELP,
|
---|
879 | GetPString(IDS_WALKDIRLISTHELPTEXT));
|
---|
880 | else if (SHORT2FROMMP(mp1) == LN_KILLFOCUS)
|
---|
881 | WinSetDlgItemText(hwnd, WALK_HELP,
|
---|
882 | GetPString(IDS_WALKDEFAULTHELPTEXT));
|
---|
883 | break;
|
---|
884 | }
|
---|
885 | return 0;
|
---|
886 |
|
---|
887 | case WM_COMMAND:
|
---|
888 | wa = WinQueryWindowPtr(hwnd, QWL_USER);
|
---|
889 | if (!wa)
|
---|
890 | WinDismissDlg(hwnd, 0);
|
---|
891 | *szBuff = 0;
|
---|
892 | WinQueryDlgItemText(hwnd, WALK_PATH, CCHMAXPATH, szBuff);
|
---|
893 | bstrip(szBuff);
|
---|
894 | while ((p = strchr(szBuff, '/')) != NULL)
|
---|
895 | *p = '\\';
|
---|
896 | while (strlen(szBuff) > 3 && szBuff[strlen(szBuff) - 1] == '\\')
|
---|
897 | szBuff[strlen(szBuff) - 1] = 0;
|
---|
898 | MakeFullName(szBuff);
|
---|
899 | if (*szBuff && stricmp(szBuff, wa->szCurrentPath)) {
|
---|
900 | if (!SetDir(WinQueryWindow(WinQueryWindow(hwnd, QW_PARENT),
|
---|
901 | QW_OWNER), hwnd, szBuff, 0))
|
---|
902 | strcpy(wa->szCurrentPath, szBuff);
|
---|
903 | else if (SHORT1FROMMP(mp1) != DID_CANCEL)
|
---|
904 | return 0;
|
---|
905 | }
|
---|
906 | WinSetDlgItemText(hwnd, WALK_PATH, wa->szCurrentPath);
|
---|
907 | switch (SHORT1FROMMP(mp1)) {
|
---|
908 | case WALK_ADD:
|
---|
909 | *szBuff = 0;
|
---|
910 | WinQueryDlgItemText(hwnd, WALK_PATH, CCHMAXPATH, szBuff);
|
---|
911 | bstrip(szBuff);
|
---|
912 | while ((p = strchr(szBuff, '/')) != NULL)
|
---|
913 | *p = '\\';
|
---|
914 | if (*szBuff && !IsFile(szBuff)) {
|
---|
915 | MakeFullName(szBuff);
|
---|
916 | if (!add_udir(TRUE, szBuff))
|
---|
917 | Runtime_Error(pszSrcFile, __LINE__, "add_udir");
|
---|
918 | else {
|
---|
919 | WinSendDlgItemMsg(hwnd,
|
---|
920 | WALK_USERLIST,
|
---|
921 | LM_INSERTITEM,
|
---|
922 | MPFROM2SHORT(LIT_SORTASCENDING, 0),
|
---|
923 | MPFROMP(szBuff));
|
---|
924 | wa->changed = 1;
|
---|
925 | }
|
---|
926 | }
|
---|
927 | break;
|
---|
928 |
|
---|
929 | case WALK_DELETE:
|
---|
930 | *szBuff = 0;
|
---|
931 | WinQueryDlgItemText(hwnd, WALK_PATH, CCHMAXPATH, szBuff);
|
---|
932 | bstrip(szBuff);
|
---|
933 | while ((p = strchr(szBuff, '/')) != NULL)
|
---|
934 | *p = '\\';
|
---|
935 | if (*szBuff && !IsFile(szBuff)) {
|
---|
936 | MakeFullName(szBuff);
|
---|
937 | sSelect = (SHORT) WinSendDlgItemMsg(hwnd,
|
---|
938 | WALK_USERLIST,
|
---|
939 | LM_SEARCHSTRING,
|
---|
940 | MPFROM2SHORT(0, LIT_FIRST),
|
---|
941 | MPFROMP(szBuff));
|
---|
942 | if (sSelect >= 0) {
|
---|
943 | WinSendDlgItemMsg(hwnd,
|
---|
944 | WALK_USERLIST,
|
---|
945 | LM_DELETEITEM, MPFROM2SHORT(sSelect, 0), MPVOID);
|
---|
946 | remove_udir(szBuff);
|
---|
947 | wa->changed = 1;
|
---|
948 | }
|
---|
949 | }
|
---|
950 | break;
|
---|
951 |
|
---|
952 | case DID_OK:
|
---|
953 | if (*wa->szCurrentPath) {
|
---|
954 | strcpy(wa->szReturnPath, wa->szCurrentPath);
|
---|
955 | MakeValidDir(wa->szReturnPath);
|
---|
956 | if (fAutoAddAllDirs)
|
---|
957 | add_udir(FALSE, wa->szReturnPath);
|
---|
958 | if (fChangeTarget) {
|
---|
959 | strcpy(targetdir, wa->szReturnPath);
|
---|
960 | PrfWriteProfileString(fmprof, appname, "Targetdir", targetdir);
|
---|
961 | }
|
---|
962 | }
|
---|
963 | if (wa->changed)
|
---|
964 | WinSendMsg(hwnd, UM_SETUP3, MPVOID, MPVOID);
|
---|
965 | WinDismissDlg(hwnd, 1);
|
---|
966 | break;
|
---|
967 |
|
---|
968 | case IDM_HELP:
|
---|
969 | if (hwndHelp)
|
---|
970 | WinSendMsg(hwndHelp,
|
---|
971 | HM_DISPLAY_HELP,
|
---|
972 | MPFROM2SHORT(HELP_WALKEM, 0), MPFROMSHORT(HM_RESOURCEID));
|
---|
973 | break;
|
---|
974 |
|
---|
975 | case DID_CANCEL:
|
---|
976 | if (wa->changed)
|
---|
977 | WinSendMsg(hwnd, UM_SETUP3, MPVOID, MPVOID);
|
---|
978 | free(wa);
|
---|
979 | WinDismissDlg(hwnd, 0);
|
---|
980 | break;
|
---|
981 | }
|
---|
982 | return 0;
|
---|
983 |
|
---|
984 | case WM_CLOSE:
|
---|
985 | break;
|
---|
986 | }
|
---|
987 | return WinDefDlgProc(hwnd, msg, mp1, mp2);
|
---|
988 | }
|
---|
989 |
|
---|
990 | MRESULT EXPENTRY WalkAllDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
---|
991 | {
|
---|
992 | switch (msg) {
|
---|
993 | case WM_INITDLG:
|
---|
994 | return WalkDlgProc(hwnd, UM_SETUP2, mp1, mp2);
|
---|
995 | }
|
---|
996 | return WalkDlgProc(hwnd, msg, mp1, mp2);
|
---|
997 | }
|
---|
998 |
|
---|
999 | MRESULT EXPENTRY WalkCopyDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
---|
1000 | {
|
---|
1001 | switch (msg) {
|
---|
1002 | case WM_INITDLG:
|
---|
1003 | WinSetWindowText(hwnd, GetPString(IDS_WALKCOPYDLGTEXT));
|
---|
1004 | return WalkDlgProc(hwnd, UM_SETUP2, mp1, mp2);
|
---|
1005 | }
|
---|
1006 | return WalkDlgProc(hwnd, msg, mp1, mp2);
|
---|
1007 | }
|
---|
1008 |
|
---|
1009 | MRESULT EXPENTRY WalkMoveDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
---|
1010 | {
|
---|
1011 | switch (msg) {
|
---|
1012 | case WM_INITDLG:
|
---|
1013 | WinSetWindowText(hwnd, GetPString(IDS_WALKMOVEDLGTEXT));
|
---|
1014 | return WalkDlgProc(hwnd, UM_SETUP2, mp1, mp2);
|
---|
1015 | }
|
---|
1016 | return WalkDlgProc(hwnd, msg, mp1, mp2);
|
---|
1017 | }
|
---|
1018 |
|
---|
1019 | MRESULT EXPENTRY WalkExtractDlgProc(HWND hwnd, ULONG msg, MPARAM mp1,
|
---|
1020 | MPARAM mp2)
|
---|
1021 | {
|
---|
1022 | switch (msg) {
|
---|
1023 | case WM_INITDLG:
|
---|
1024 | WinSetWindowText(hwnd, GetPString(IDS_WALKEXTRACTDLGTEXT));
|
---|
1025 | return WalkDlgProc(hwnd, UM_SETUP2, mp1, mp2);
|
---|
1026 | }
|
---|
1027 | return WalkDlgProc(hwnd, msg, mp1, mp2);
|
---|
1028 | }
|
---|
1029 |
|
---|
1030 | MRESULT EXPENTRY WalkTargetDlgProc(HWND hwnd, ULONG msg, MPARAM mp1,
|
---|
1031 | MPARAM mp2)
|
---|
1032 | {
|
---|
1033 | switch (msg) {
|
---|
1034 | case WM_INITDLG:
|
---|
1035 | {
|
---|
1036 | char s[CCHMAXPATH + 32];
|
---|
1037 |
|
---|
1038 | sprintf(s,
|
---|
1039 | GetPString(IDS_WALKTARGETDLGTEXT),
|
---|
1040 | (*targetdir) ?
|
---|
1041 | NullStr :
|
---|
1042 | " (",
|
---|
1043 | (*targetdir) ?
|
---|
1044 | NullStr : GetPString(IDS_NONE), (*targetdir) ? NullStr : ")");
|
---|
1045 | WinSetWindowText(hwnd, s);
|
---|
1046 | }
|
---|
1047 | return WalkDlgProc(hwnd, UM_SETUP2, mp1, mp2);
|
---|
1048 | }
|
---|
1049 | return WalkDlgProc(hwnd, msg, mp1, mp2);
|
---|
1050 | }
|
---|
1051 |
|
---|
1052 | MRESULT EXPENTRY WalkTwoDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
---|
1053 | {
|
---|
1054 | WALK2 *wa;
|
---|
1055 | CHAR szBuff[CCHMAXPATH + 1], szBuffer[CCHMAXPATH + 1], *p;
|
---|
1056 | SHORT sSelect;
|
---|
1057 | static BOOL okay; /* avoid combobox selecting as filled */
|
---|
1058 |
|
---|
1059 | switch (msg) {
|
---|
1060 | case UM_SETUP2:
|
---|
1061 | case WM_INITDLG:
|
---|
1062 | okay = FALSE;
|
---|
1063 | if (!mp2) {
|
---|
1064 | WinDismissDlg(hwnd, 0);
|
---|
1065 | break;
|
---|
1066 | }
|
---|
1067 | WinSetWindowPtr(hwnd, QWL_USER, mp2);
|
---|
1068 | wa = mp2;
|
---|
1069 | {
|
---|
1070 | PFNWP oldproc;
|
---|
1071 |
|
---|
1072 | oldproc = WinSubclassWindow(WinWindowFromID(hwnd, WALK_PATH),
|
---|
1073 | (PFNWP) TextSubProc);
|
---|
1074 | if (oldproc)
|
---|
1075 | WinSetWindowPtr(WinWindowFromID(hwnd, WALK_PATH),
|
---|
1076 | QWL_USER, (PVOID) oldproc);
|
---|
1077 | oldproc = WinSubclassWindow(WinWindowFromID(hwnd, WALK2_PATH),
|
---|
1078 | (PFNWP) TextSubProc);
|
---|
1079 | if (oldproc)
|
---|
1080 | WinSetWindowPtr(WinWindowFromID(hwnd, WALK2_PATH),
|
---|
1081 | QWL_USER, (PVOID) oldproc);
|
---|
1082 | }
|
---|
1083 | if (!*wa->szCurrentPath1)
|
---|
1084 | save_dir2(wa->szCurrentPath1);
|
---|
1085 | MakeFullName(wa->szCurrentPath1);
|
---|
1086 | if (!*wa->szCurrentPath2)
|
---|
1087 | save_dir2(wa->szCurrentPath2);
|
---|
1088 | MakeFullName(wa->szCurrentPath2);
|
---|
1089 | WinSendDlgItemMsg(hwnd,
|
---|
1090 | WALK_PATH,
|
---|
1091 | EM_SETTEXTLIMIT, MPFROM2SHORT(CCHMAXPATH, 0), MPVOID);
|
---|
1092 | WinSetDlgItemText(hwnd, WALK_PATH, wa->szCurrentPath1);
|
---|
1093 | WinSendDlgItemMsg(hwnd, WALK2_PATH, EM_SETTEXTLIMIT,
|
---|
1094 | MPFROM2SHORT(CCHMAXPATH, 0), MPVOID);
|
---|
1095 | WinSetDlgItemText(hwnd, WALK2_PATH, wa->szCurrentPath2);
|
---|
1096 | FillPathListBox(hwnd,
|
---|
1097 | WinWindowFromID(hwnd, WALK_DRIVELIST),
|
---|
1098 | WinWindowFromID(hwnd, WALK_DIRLIST),
|
---|
1099 | wa->szCurrentPath1, FALSE);
|
---|
1100 | FillPathListBox(hwnd,
|
---|
1101 | WinWindowFromID(hwnd, WALK2_DRIVELIST),
|
---|
1102 | WinWindowFromID(hwnd, WALK2_DIRLIST),
|
---|
1103 | wa->szCurrentPath2, FALSE);
|
---|
1104 | if (!PostMsg(hwnd, UM_SETUP4, MPVOID, MPVOID))
|
---|
1105 | okay = TRUE;
|
---|
1106 | {
|
---|
1107 | MRESULT ret;
|
---|
1108 |
|
---|
1109 | ret = WinDefDlgProc(hwnd, WM_INITDLG, mp1, mp2);
|
---|
1110 | WinSendMsg(hwnd, UM_SETUP, MPVOID, MPVOID);
|
---|
1111 | WinInvalidateRect(WinWindowFromID(hwnd, WALK_PATH), NULL, TRUE);
|
---|
1112 | WinInvalidateRect(WinWindowFromID(hwnd, WALK2_PATH), NULL, TRUE);
|
---|
1113 | return ret;
|
---|
1114 | }
|
---|
1115 |
|
---|
1116 | case UM_SETUP4:
|
---|
1117 | okay = TRUE;
|
---|
1118 | return 0;
|
---|
1119 |
|
---|
1120 | case WM_PRESPARAMCHANGED:
|
---|
1121 | {
|
---|
1122 | ULONG AttrFound, AttrValue[64], cbRetLen;
|
---|
1123 |
|
---|
1124 | cbRetLen = WinQueryPresParam(hwnd, (ULONG) mp1, 0, &AttrFound,
|
---|
1125 | (ULONG) sizeof(AttrValue), &AttrValue, 0);
|
---|
1126 | if (cbRetLen) {
|
---|
1127 | switch (AttrFound) {
|
---|
1128 | case PP_FONTNAMESIZE:
|
---|
1129 | PrfWriteProfileData(fmprof,
|
---|
1130 | appname,
|
---|
1131 | "WalkFont", (PVOID) AttrValue, cbRetLen);
|
---|
1132 | *WalkFont = 0;
|
---|
1133 | WalkFontSize = sizeof(WalkFont);
|
---|
1134 | WinInvalidateRect(WinWindowFromID(hwnd, WALK_PATH), NULL, TRUE);
|
---|
1135 | break;
|
---|
1136 | }
|
---|
1137 | }
|
---|
1138 | }
|
---|
1139 | break;
|
---|
1140 |
|
---|
1141 | case UM_SETUP:
|
---|
1142 | {
|
---|
1143 | INT x;
|
---|
1144 | USHORT id[] = { WALK_PATH, WALK_DIRLIST,
|
---|
1145 | WALK2_PATH, WALK2_DIRLIST, 0
|
---|
1146 | };
|
---|
1147 |
|
---|
1148 | if (*WalkFont ||
|
---|
1149 | (PrfQueryProfileData(fmprof,
|
---|
1150 | appname,
|
---|
1151 | "WalkFont",
|
---|
1152 | (PVOID) WalkFont,
|
---|
1153 | &WalkFontSize) && WalkFontSize)) {
|
---|
1154 | for (x = 0; id[x]; x++)
|
---|
1155 | WinSetPresParam(WinWindowFromID(hwnd, id[x]),
|
---|
1156 | PP_FONTNAMESIZE, WalkFontSize, (PVOID) WalkFont);
|
---|
1157 | }
|
---|
1158 | }
|
---|
1159 | return 0;
|
---|
1160 |
|
---|
1161 | case UM_CONTROL:
|
---|
1162 | case WM_CONTROL:
|
---|
1163 | wa = WinQueryWindowPtr(hwnd, QWL_USER);
|
---|
1164 | if (SHORT1FROMMP(mp1) == WALK_DRIVELIST ||
|
---|
1165 | SHORT1FROMMP(mp1) == WALK_DIRLIST ||
|
---|
1166 | SHORT1FROMMP(mp1) == WALK2_DRIVELIST ||
|
---|
1167 | SHORT1FROMMP(mp1) == WALK2_DIRLIST) {
|
---|
1168 | sSelect = (USHORT) WinSendDlgItemMsg(hwnd,
|
---|
1169 | SHORT1FROMMP(mp1),
|
---|
1170 | LM_QUERYSELECTION, MPVOID, MPVOID);
|
---|
1171 | *szBuffer = 0;
|
---|
1172 | if (sSelect >= 0)
|
---|
1173 | WinSendDlgItemMsg(hwnd, SHORT1FROMMP(mp1), LM_QUERYITEMTEXT,
|
---|
1174 | MPFROM2SHORT(sSelect, CCHMAXPATH),
|
---|
1175 | MPFROMP(szBuffer));
|
---|
1176 | }
|
---|
1177 | switch (SHORT1FROMMP(mp1)) {
|
---|
1178 | case WALK_DRIVELIST:
|
---|
1179 | if (okay && *szBuffer && SHORT2FROMMP(mp1) == LN_ENTER) {
|
---|
1180 |
|
---|
1181 | ULONG ulDirLen = CCHMAXPATH;
|
---|
1182 | APIRET rc;
|
---|
1183 |
|
---|
1184 | rc = DosQCurDir(toupper(*szBuffer) - '@', &szBuff[3], &ulDirLen);
|
---|
1185 | if (!rc) {
|
---|
1186 | strcpy(wa->szCurrentPath1, "C:\\");
|
---|
1187 | *wa->szCurrentPath1 = toupper(*szBuffer);
|
---|
1188 | WinSetDlgItemText(hwnd, WALK_PATH, wa->szCurrentPath1);
|
---|
1189 | FillPathListBox(hwnd,
|
---|
1190 | WinWindowFromID(hwnd, WALK_DRIVELIST),
|
---|
1191 | WinWindowFromID(hwnd, WALK_DIRLIST),
|
---|
1192 | wa->szCurrentPath1, FALSE);
|
---|
1193 | }
|
---|
1194 | }
|
---|
1195 | break;
|
---|
1196 |
|
---|
1197 | case WALK_DIRLIST:
|
---|
1198 | if (okay && SHORT2FROMMP(mp1) == LN_ENTER) {
|
---|
1199 |
|
---|
1200 | ULONG ulSearchCount;
|
---|
1201 | FILEFINDBUF3 findbuf;
|
---|
1202 | HDIR hDir;
|
---|
1203 | APIRET rc;
|
---|
1204 |
|
---|
1205 | bstrip(szBuffer);
|
---|
1206 | if (*szBuffer) {
|
---|
1207 | strcpy(szBuff, wa->szCurrentPath1);
|
---|
1208 | if (szBuff[strlen(szBuff) - 1] != '\\')
|
---|
1209 | strcat(szBuff, "\\");
|
---|
1210 | strcat(szBuff, szBuffer);
|
---|
1211 | MakeFullName(szBuff);
|
---|
1212 | DosError(FERR_DISABLEHARDERR);
|
---|
1213 | hDir = HDIR_CREATE;
|
---|
1214 | ulSearchCount = 1L;
|
---|
1215 | if (!IsRoot(szBuff)) {
|
---|
1216 | rc = DosFindFirst(szBuff,
|
---|
1217 | &hDir,
|
---|
1218 | FILE_DIRECTORY |
|
---|
1219 | MUST_HAVE_DIRECTORY | FILE_READONLY |
|
---|
1220 | FILE_ARCHIVED | FILE_SYSTEM | FILE_HIDDEN,
|
---|
1221 | &findbuf,
|
---|
1222 | sizeof(FILEFINDBUF3),
|
---|
1223 | &ulSearchCount, FIL_STANDARD);
|
---|
1224 | if (!rc)
|
---|
1225 | DosFindClose(hDir);
|
---|
1226 | }
|
---|
1227 | else {
|
---|
1228 | findbuf.attrFile = FILE_DIRECTORY;
|
---|
1229 | rc = 0;
|
---|
1230 | }
|
---|
1231 | if (!rc && (findbuf.attrFile & FILE_DIRECTORY)) {
|
---|
1232 | strcpy(wa->szCurrentPath1, szBuff);
|
---|
1233 | WinSetDlgItemText(hwnd, WALK_PATH, wa->szCurrentPath1);
|
---|
1234 | FillPathListBox(hwnd,
|
---|
1235 | WinWindowFromID(hwnd, WALK_DRIVELIST),
|
---|
1236 | WinWindowFromID(hwnd, WALK_DIRLIST),
|
---|
1237 | wa->szCurrentPath1, FALSE);
|
---|
1238 | }
|
---|
1239 | }
|
---|
1240 | }
|
---|
1241 | break;
|
---|
1242 |
|
---|
1243 | case WALK2_DRIVELIST:
|
---|
1244 | if (okay && *szBuffer && SHORT2FROMMP(mp1) == LN_ENTER) {
|
---|
1245 |
|
---|
1246 | ULONG ulDirLen = CCHMAXPATH;
|
---|
1247 | APIRET rc;
|
---|
1248 |
|
---|
1249 | rc = DosQCurDir(toupper(*szBuffer) - '@', &szBuff[3], &ulDirLen);
|
---|
1250 | if (!rc) {
|
---|
1251 | strcpy(wa->szCurrentPath2, "C:\\");
|
---|
1252 | *wa->szCurrentPath2 = toupper(*szBuffer);
|
---|
1253 | WinSetDlgItemText(hwnd, WALK2_PATH, wa->szCurrentPath2);
|
---|
1254 | FillPathListBox(hwnd,
|
---|
1255 | WinWindowFromID(hwnd, WALK2_DRIVELIST),
|
---|
1256 | WinWindowFromID(hwnd, WALK2_DIRLIST),
|
---|
1257 | wa->szCurrentPath2, FALSE);
|
---|
1258 | }
|
---|
1259 | }
|
---|
1260 | break;
|
---|
1261 |
|
---|
1262 | case WALK2_DIRLIST:
|
---|
1263 | if (okay && SHORT2FROMMP(mp1) == LN_ENTER) {
|
---|
1264 |
|
---|
1265 | ULONG ulSearchCount;
|
---|
1266 | FILEFINDBUF3 findbuf;
|
---|
1267 | HDIR hDir;
|
---|
1268 | APIRET rc;
|
---|
1269 |
|
---|
1270 | bstrip(szBuffer);
|
---|
1271 | if (*szBuffer) {
|
---|
1272 | strcpy(szBuff, wa->szCurrentPath2);
|
---|
1273 | if (szBuff[strlen(szBuff) - 1] != '\\')
|
---|
1274 | strcat(szBuff, "\\");
|
---|
1275 | strcat(szBuff, szBuffer);
|
---|
1276 | MakeFullName(szBuff);
|
---|
1277 | DosError(FERR_DISABLEHARDERR);
|
---|
1278 | hDir = HDIR_CREATE;
|
---|
1279 | ulSearchCount = 1L;
|
---|
1280 | if (!IsRoot(szBuff)) {
|
---|
1281 | rc = DosFindFirst(szBuff,
|
---|
1282 | &hDir,
|
---|
1283 | FILE_DIRECTORY |
|
---|
1284 | MUST_HAVE_DIRECTORY | FILE_READONLY |
|
---|
1285 | FILE_ARCHIVED | FILE_SYSTEM | FILE_HIDDEN,
|
---|
1286 | &findbuf,
|
---|
1287 | sizeof(FILEFINDBUF3),
|
---|
1288 | &ulSearchCount, FIL_STANDARD);
|
---|
1289 | if (!rc)
|
---|
1290 | DosFindClose(hDir);
|
---|
1291 | }
|
---|
1292 | else {
|
---|
1293 | findbuf.attrFile = FILE_DIRECTORY;
|
---|
1294 | rc = 0;
|
---|
1295 | }
|
---|
1296 | if (!rc && (findbuf.attrFile & FILE_DIRECTORY)) {
|
---|
1297 | strcpy(wa->szCurrentPath2, szBuff);
|
---|
1298 | WinSetDlgItemText(hwnd, WALK2_PATH, wa->szCurrentPath2);
|
---|
1299 | FillPathListBox(hwnd,
|
---|
1300 | WinWindowFromID(hwnd, WALK2_DRIVELIST),
|
---|
1301 | WinWindowFromID(hwnd, WALK2_DIRLIST),
|
---|
1302 | wa->szCurrentPath2, FALSE);
|
---|
1303 | }
|
---|
1304 | }
|
---|
1305 | }
|
---|
1306 | break;
|
---|
1307 | }
|
---|
1308 | return 0;
|
---|
1309 |
|
---|
1310 | case WM_COMMAND:
|
---|
1311 | wa = WinQueryWindowPtr(hwnd, QWL_USER);
|
---|
1312 | if (!wa)
|
---|
1313 | WinDismissDlg(hwnd, 0);
|
---|
1314 | *szBuff = 0;
|
---|
1315 | WinQueryDlgItemText(hwnd, WALK_PATH, CCHMAXPATH, szBuff);
|
---|
1316 | bstrip(szBuff);
|
---|
1317 | while ((p = strchr(szBuff, '/')) != NULL)
|
---|
1318 | *p = '\\';
|
---|
1319 | while (strlen(szBuff) > 3 && szBuff[strlen(szBuff) - 1] == '\\')
|
---|
1320 | szBuff[strlen(szBuff) - 1] = 0;
|
---|
1321 | MakeFullName(szBuff);
|
---|
1322 | if (*szBuff && stricmp(szBuff, wa->szCurrentPath1)) {
|
---|
1323 | if (!SetDir(WinQueryWindow(WinQueryWindow(hwnd, QW_PARENT),
|
---|
1324 | QW_OWNER), hwnd, szBuff, 0))
|
---|
1325 | strcpy(wa->szCurrentPath1, szBuff);
|
---|
1326 | else if (SHORT1FROMMP(mp1) != DID_CANCEL)
|
---|
1327 | return 0;
|
---|
1328 | }
|
---|
1329 | WinSetDlgItemText(hwnd, WALK_PATH, wa->szCurrentPath1);
|
---|
1330 | *szBuff = 0;
|
---|
1331 | WinQueryDlgItemText(hwnd, WALK2_PATH, CCHMAXPATH, szBuff);
|
---|
1332 | bstrip(szBuff);
|
---|
1333 | while ((p = strchr(szBuff, '/')) != NULL)
|
---|
1334 | *p = '\\';
|
---|
1335 | while (strlen(szBuff) > 3 && szBuff[strlen(szBuff) - 1] == '\\')
|
---|
1336 | szBuff[strlen(szBuff) - 1] = 0;
|
---|
1337 | MakeFullName(szBuff);
|
---|
1338 | if (*szBuff && stricmp(szBuff, wa->szCurrentPath2)) {
|
---|
1339 | if (!SetDir(WinQueryWindow(WinQueryWindow(hwnd, QW_PARENT),
|
---|
1340 | QW_OWNER), hwnd, szBuff, 0))
|
---|
1341 | strcpy(wa->szCurrentPath2, szBuff);
|
---|
1342 | else if (SHORT1FROMMP(mp1) != DID_CANCEL)
|
---|
1343 | return 0;
|
---|
1344 | }
|
---|
1345 | WinSetDlgItemText(hwnd, WALK2_PATH, wa->szCurrentPath2);
|
---|
1346 | switch (SHORT1FROMMP(mp1)) {
|
---|
1347 | case DID_OK:
|
---|
1348 | WinDismissDlg(hwnd, 1);
|
---|
1349 | break;
|
---|
1350 |
|
---|
1351 | case IDM_HELP:
|
---|
1352 | if (hwndHelp)
|
---|
1353 | WinSendMsg(hwndHelp,
|
---|
1354 | HM_DISPLAY_HELP,
|
---|
1355 | MPFROM2SHORT(HELP_WALKEM2, 0), MPFROMSHORT(HM_RESOURCEID));
|
---|
1356 | break;
|
---|
1357 |
|
---|
1358 | case DID_CANCEL:
|
---|
1359 | WinDismissDlg(hwnd, 0);
|
---|
1360 | break;
|
---|
1361 | }
|
---|
1362 | return 0;
|
---|
1363 |
|
---|
1364 | case WM_CLOSE:
|
---|
1365 | break;
|
---|
1366 | }
|
---|
1367 | return WinDefDlgProc(hwnd, msg, mp1, mp2);
|
---|
1368 | }
|
---|
1369 |
|
---|
1370 | MRESULT EXPENTRY WalkTwoCmpDlgProc(HWND hwnd, ULONG msg, MPARAM mp1,
|
---|
1371 | MPARAM mp2)
|
---|
1372 | {
|
---|
1373 | switch (msg) {
|
---|
1374 | case WM_INITDLG:
|
---|
1375 | WinSetWindowText(hwnd, GetPString(IDS_WALKCOMPAREDLGTEXT));
|
---|
1376 | return WalkTwoDlgProc(hwnd, UM_SETUP2, mp1, mp2);
|
---|
1377 | }
|
---|
1378 | return WalkTwoDlgProc(hwnd, msg, mp1, mp2);
|
---|
1379 | }
|
---|
1380 |
|
---|
1381 | MRESULT EXPENTRY WalkTwoSetDlgProc(HWND hwnd, ULONG msg, MPARAM mp1,
|
---|
1382 | MPARAM mp2)
|
---|
1383 | {
|
---|
1384 | switch (msg) {
|
---|
1385 | case WM_INITDLG:
|
---|
1386 | WinSetWindowText(hwnd, GetPString(IDS_WALKSETDIRSDLGTEXT));
|
---|
1387 | return WalkTwoDlgProc(hwnd, UM_SETUP2, mp1, mp2);
|
---|
1388 | }
|
---|
1389 | return WalkTwoDlgProc(hwnd, msg, mp1, mp2);
|
---|
1390 | }
|
---|