source: trunk/src/user32/windlg.cpp@ 4825

Last change on this file since 4825 was 4825, checked in by sandervl, 25 years ago

hook, mdi & focus fixes

File size: 23.4 KB
Line 
1/* $Id: windlg.cpp,v 1.19 2000-12-17 15:04:13 sandervl Exp $ */
2/*
3 * Win32 dialog apis for OS/2
4 *
5 * Copyright 1999 Sander van Leeuwen
6 *
7 * Parts based on Wine code (990815; window\dialog.c)
8 *
9 * Copyright 1993, 1994, 1996 Alexandre Julliard
10 *
11 * Project Odin Software License can be found in LICENSE.TXT
12 *
13 */
14#include <ctype.h>
15#include <wchar.h>
16#include <os2win.h>
17#include <misc.h>
18#include <stdio.h>
19#include <string.h>
20#include <stdlib.h>
21#include <limits.h>
22#include <errno.h>
23#include "win32wbase.h"
24#include "win32dlg.h"
25#include <heapstring.h>
26#include <win\drive.h>
27
28#define DBG_LOCALLOG DBG_windlg
29#include "dbglocal.h"
30
31static INT DIALOG_DlgDirListW( HWND hDlg, LPWSTR spec, INT idLBox, INT idStatic, UINT attrib, BOOL combo );
32static INT DIALOG_DlgDirList( HWND hDlg, LPSTR spec, INT idLBox, INT idStatic, UINT attrib, BOOL combo );
33static BOOL DIALOG_DlgDirSelect( HWND hwnd, LPSTR str, INT len, INT id, BOOL win32, BOOL unicode, BOOL combo );
34
35//******************************************************************************
36//******************************************************************************
37HWND WIN32API CreateDialogParamA(HINSTANCE hInst, LPCSTR lpszTemplate,
38 HWND hwndOwner, DLGPROC dlgproc,
39 LPARAM lParamInit)
40{
41 HANDLE hrsrc = FindResourceA( hInst, lpszTemplate, RT_DIALOGA );
42
43 if (!hrsrc) {
44 dprintf(("WARNING: CreateDialogParamA: Dialog %x not found!!", lpszTemplate));
45 return 0;
46 }
47
48 return CreateDialogIndirectParamA(hInst, (LPCDLGTEMPLATEA)LoadResource(hInst, hrsrc),
49 hwndOwner, dlgproc, lParamInit);
50}
51//******************************************************************************
52//******************************************************************************
53HWND WIN32API CreateDialogParamW(HINSTANCE hInst, LPCWSTR lpszTemplate,
54 HWND hwndOwner, DLGPROC dlgproc,
55 LPARAM lParamInit)
56{
57 HANDLE hrsrc = FindResourceW( hInst, lpszTemplate, RT_DIALOGW );
58
59 if (!hrsrc) {
60 dprintf(("WARNING: CreateDialogParamW: Dialog %x not found!!", lpszTemplate));
61 return 0;
62 }
63 return CreateDialogIndirectParamW(hInst, (LPCDLGTEMPLATEW)LoadResource(hInst, hrsrc),
64 hwndOwner, dlgproc, lParamInit);
65}
66//******************************************************************************
67//******************************************************************************
68HWND WIN32API CreateDialogIndirectParamA(HINSTANCE hInst,
69 LPCDLGTEMPLATEA dlgtemplate,
70 HWND hwndParent, DLGPROC dlgproc,
71 LPARAM lParamInit)
72{
73 Win32Dialog *dialog;
74
75 dprintf(("CreateDialogIndirectParamA: %x %x %x %x %x", hInst, dlgtemplate, hwndParent, dlgproc, lParamInit));
76
77 if (!dlgtemplate) return 0;
78
79 dialog = new Win32Dialog(hInst, (LPCSTR)dlgtemplate, hwndParent, dlgproc, lParamInit, FALSE);
80
81 if(dialog == NULL)
82 {
83 dprintf(("Win32Dialog creation failed!!"));
84 return 0;
85 }
86 if(GetLastError() != 0)
87 {
88 dprintf(("Win32Dialog error found (%0x)!!", GetLastError()));
89 delete dialog;
90 return 0;
91 }
92 return dialog->getWindowHandle();
93}
94//******************************************************************************
95//******************************************************************************
96HWND WIN32API CreateDialogIndirectParamW(HINSTANCE hInst,
97 LPCDLGTEMPLATEW dlgtemplate,
98 HWND hwndParent, DLGPROC dlgproc,
99 LPARAM lParamInit)
100{
101 Win32Dialog *dialog;
102
103 dprintf(("CreateDialogIndirectParamW: %x %x %x %x %x", hInst, dlgtemplate, hwndParent, dlgproc, lParamInit));
104
105 if (!dlgtemplate) return 0;
106
107 dialog = new Win32Dialog(hInst, (LPCSTR)dlgtemplate, hwndParent, dlgproc, lParamInit, TRUE);
108
109 if(dialog == NULL)
110 {
111 dprintf(("Win32Dialog creation failed!!"));
112 return 0;
113 }
114 if(GetLastError() != 0)
115 {
116 dprintf(("Win32Dialog error found!!"));
117 delete dialog;
118 return 0;
119 }
120 return dialog->getWindowHandle();
121}
122//******************************************************************************
123//******************************************************************************
124INT WIN32API DialogBoxIndirectParamA(HINSTANCE hInst,
125 LPCDLGTEMPLATEA dlgtemplate,
126 HWND hwndParent, DLGPROC dlgproc,
127 LPARAM lParamInit)
128{
129 HWND hwnd = CreateDialogIndirectParamA(hInst, dlgtemplate, hwndParent, dlgproc,
130 lParamInit);
131 if (hwnd)
132 {
133 Win32Dialog *dialog;
134
135 dialog = (Win32Dialog *)Win32BaseWindow::GetWindowFromHandle(hwnd);
136 if(!dialog || !dialog->IsDialog()) {
137 dprintf(("DialogBoxIndirectParamA, dialog %x not found", hwnd));
138 SetLastError(ERROR_INVALID_WINDOW_HANDLE);
139 return 0;
140 }
141 return dialog->doDialogBox();
142 }
143 return -1;
144}
145//******************************************************************************
146//******************************************************************************
147INT WIN32API DialogBoxIndirectParamW(HINSTANCE hInst, LPCDLGTEMPLATEW dlgtemplate,
148 HWND hwndParent, DLGPROC dlgproc,
149 LPARAM lParamInit)
150{
151 HWND hwnd = CreateDialogIndirectParamW(hInst, dlgtemplate, hwndParent, dlgproc,
152 lParamInit);
153 if (hwnd)
154 {
155 Win32Dialog *dialog;
156
157 dialog = (Win32Dialog *)Win32BaseWindow::GetWindowFromHandle(hwnd);
158 if(!dialog || !dialog->IsDialog()) {
159 dprintf(("DialogBoxIndirectParamW, dialog %x not found", hwnd));
160 SetLastError(ERROR_INVALID_WINDOW_HANDLE);
161 return 0;
162 }
163 return dialog->doDialogBox();
164 }
165 return -1;
166}
167//******************************************************************************
168//******************************************************************************
169int WIN32API DialogBoxParamA(HINSTANCE hInst, LPCSTR lpszTemplate, HWND hwndOwner,
170 DLGPROC dlgproc, LPARAM lParamInit)
171{
172 HWND hwnd = CreateDialogParamA( hInst, lpszTemplate, hwndOwner, dlgproc, lParamInit);
173
174 if (hwnd)
175 {
176 Win32Dialog *dialog;
177
178 dialog = (Win32Dialog *)Win32BaseWindow::GetWindowFromHandle(hwnd);
179 if(!dialog || !dialog->IsDialog()) {
180 dprintf(("DialogBoxParamA, dialog %x not found", hwnd));
181 SetLastError(ERROR_INVALID_WINDOW_HANDLE);
182 return 0;
183 }
184 return dialog->doDialogBox();
185 }
186 return -1;
187}
188//******************************************************************************
189//******************************************************************************
190int WIN32API DialogBoxParamW(HINSTANCE hInst, LPCWSTR lpszTemplate, HWND hwndOwner,
191 DLGPROC dlgproc, LPARAM lParamInit)
192{
193 HWND hwnd = CreateDialogParamW( hInst, lpszTemplate, hwndOwner, dlgproc, lParamInit);
194
195 if (hwnd)
196 {
197 Win32Dialog *dialog;
198
199 dialog = (Win32Dialog *)Win32BaseWindow::GetWindowFromHandle(hwnd);
200 if(!dialog || !dialog->IsDialog()) {
201 dprintf(("DialogBoxParamW, dialog %x not found", hwnd));
202 SetLastError(ERROR_INVALID_WINDOW_HANDLE);
203 return 0;
204 }
205 return dialog->doDialogBox();
206 }
207 return -1;
208}
209/***********************************************************************
210 * MapDialogRect32 (USER32.382)
211 */
212BOOL WIN32API MapDialogRect(HWND hwndDlg, LPRECT rect)
213{
214 Win32Dialog *dialog;
215#ifdef DEBUG
216 BOOL rc;
217 RECT dlgRect = *rect;
218#endif
219
220 dialog = (Win32Dialog *)Win32BaseWindow::GetWindowFromHandle(hwndDlg);
221 if(!dialog || !dialog->IsDialog()) {
222 dprintf(("MapDialogRect, window %x not found", hwndDlg));
223 SetLastError(ERROR_INVALID_WINDOW_HANDLE);
224 return 0;
225 }
226#ifdef DEBUG
227 rc = dialog->MapDialogRect(rect);
228 dprintf(("USER32: MapDialogRect %x (%d,%d)(%d,%d) -> (%d,%d)(%d,%d)", hwndDlg, dlgRect.left, dlgRect.top, dlgRect.right, dlgRect.bottom, rect->left, rect->top, rect->right, rect->bottom));
229 return rc;
230#else
231 dprintf(("USER32: MapDialogRect %x (%d,%d)(%d,%d)", hwndDlg, rect->left, rect->top, rect->right, rect->bottom));
232 return dialog->MapDialogRect(rect);
233#endif
234}
235//******************************************************************************
236//******************************************************************************
237BOOL WIN32API IsDlgButtonChecked( HWND hwnd, UINT id)
238{
239 dprintf(("USER32: IsDlgButtonChecked\n"));
240
241 return (BOOL)SendDlgItemMessageA(hwnd, id,BM_GETCHECK,0,0);
242}
243//******************************************************************************
244//******************************************************************************
245HWND WIN32API GetNextDlgTabItem(HWND hwndDlg, HWND hwndCtrl, BOOL fPrevious)
246{
247 Win32BaseWindow *window;
248
249 window = (Win32BaseWindow*)Win32BaseWindow::GetWindowFromHandle(hwndDlg);
250 if(!window) {
251 dprintf(("GetNextDlgTabItem, window %x not found", hwndDlg));
252 SetLastError(ERROR_INVALID_WINDOW_HANDLE);
253 return 0;
254 }
255 dprintf(("USER32: GetNextDlgTabItem\n"));
256 return window->getNextDlgTabItem(hwndCtrl, fPrevious);
257}
258//******************************************************************************
259//Can be used for any parent-child pair
260//******************************************************************************
261HWND WIN32API GetDlgItem(HWND hwnd, int id)
262{
263 Win32BaseWindow *dlgcontrol, *window;
264
265 window = (Win32Dialog *)Win32BaseWindow::GetWindowFromHandle(hwnd);
266 if(!window) {
267 dprintf(("GetDlgItem, window %x not found", hwnd));
268 SetLastError(ERROR_INVALID_WINDOW_HANDLE);
269 return 0;
270 }
271 dlgcontrol = window->FindWindowById(id);
272 if(dlgcontrol) {
273 dprintf(("USER32: GetDlgItem %x %d returned %x\n", hwnd, id, dlgcontrol->getWindowHandle()));
274 return dlgcontrol->getWindowHandle();
275 }
276 dprintf(("USER32: GetDlgItem %x %d NOT FOUND!\n", hwnd, id));
277 SetLastError(ERROR_INVALID_PARAMETER);
278 return 0;
279}
280//******************************************************************************
281//******************************************************************************
282int WIN32API GetDlgCtrlID(HWND hwnd)
283{
284 Win32BaseWindow *dlgcontrol;
285
286 dlgcontrol = Win32BaseWindow::GetWindowFromHandle(hwnd);
287 if(!dlgcontrol) {
288 dprintf(("GetDlgCtrlID, control %x not found", hwnd));
289 SetLastError(ERROR_INVALID_WINDOW_HANDLE);
290 return 0;
291 }
292 dprintf(("USER32: GetDlgCtrlID %x", hwnd));
293 return dlgcontrol->getWindowId();
294}
295//******************************************************************************
296//******************************************************************************
297BOOL WIN32API EndDialog(HWND hwnd, int retval)
298{
299 Win32Dialog *dialog;
300
301 dialog = (Win32Dialog *)Win32BaseWindow::GetWindowFromHandle(hwnd);
302 if(!dialog || !dialog->IsDialog()) {
303 dprintf(("GetDlgItem, window %x not found", hwnd));
304 SetLastError(ERROR_INVALID_WINDOW_HANDLE);
305 return 0;
306 }
307 dprintf(("USER32: EndDialog %x %d", hwnd, retval));
308 return dialog->endDialog(retval);
309}
310//******************************************************************************
311//******************************************************************************
312BOOL WIN32API CheckDlgButton( HWND hwnd, int id, UINT check)
313{
314 dprintf(("USER32: CheckDlgButton %x %d %d", hwnd, id, check));
315
316 return (BOOL)SendDlgItemMessageA(hwnd, id, BM_SETCHECK, check,0);
317}
318//******************************************************************************
319//******************************************************************************
320BOOL WIN32API CheckRadioButton( HWND hDlg, UINT nIDFirstButton, UINT nIDLastButton, UINT nIDCheckButton)
321{
322 dprintf(("USER32: CheckRadioButton %x %d %d %d", hDlg, nIDFirstButton, nIDLastButton, nIDCheckButton));
323
324 //CB: check radio buttons in interval
325 if (nIDFirstButton > nIDLastButton)
326 {
327 SetLastError(ERROR_INVALID_PARAMETER);
328 return (FALSE);
329 }
330
331 for (UINT x = nIDFirstButton;x <= nIDLastButton;x++)
332 {
333 SendDlgItemMessageA(hDlg,x,BM_SETCHECK,(x == nIDCheckButton) ? BST_CHECKED : BST_UNCHECKED,0);
334 }
335
336 return (TRUE);
337}
338//******************************************************************************
339//******************************************************************************
340UINT WIN32API GetDlgItemTextA(HWND hwnd, int id, LPSTR lpszName, UINT cch)
341{
342 return SendDlgItemMessageA( hwnd, id, WM_GETTEXT, cch, (LPARAM)lpszName);
343}
344//*****************************************************************************
345//*****************************************************************************
346UINT WIN32API GetDlgItemTextW(HWND hwnd, int id, LPWSTR lpszName, UINT cch)
347{
348 return SendDlgItemMessageW( hwnd, id, WM_GETTEXT, cch, (LPARAM)lpszName);
349}
350//******************************************************************************
351//******************************************************************************
352BOOL WIN32API SetDlgItemInt( HWND hwnd, int idControl, UINT uValue, BOOL fSigned)
353{
354 char str[20];
355
356 dprintf(("USER32: SetDlgItemInt\n"));
357
358 if (fSigned)
359 sprintf( str, "%d", (INT)uValue );
360 else sprintf( str, "%u", uValue );
361
362 return SendDlgItemMessageA( hwnd, idControl, WM_SETTEXT, 0, (LPARAM)str );
363}
364//******************************************************************************
365//******************************************************************************
366BOOL WIN32API SetDlgItemTextA( HWND hwnd, int id, LPCSTR lpszName)
367{
368 return SendDlgItemMessageA( hwnd, id, WM_SETTEXT, 0, (LPARAM)lpszName );
369}
370//******************************************************************************
371//******************************************************************************
372BOOL WIN32API SetDlgItemTextW( HWND hwnd, int id, LPCWSTR lpszName)
373{
374 return SendDlgItemMessageW( hwnd, id, WM_SETTEXT, 0, (LPARAM)lpszName );
375}
376//******************************************************************************
377//******************************************************************************
378UINT WIN32API GetDlgItemInt(HWND hwnd, INT id, BOOL *translated, BOOL fSigned)
379{
380 char str[30];
381 char * endptr;
382 long result = 0;
383
384 dprintf(("USER32: GetDlgItemInt\n"));
385 if (translated) *translated = FALSE;
386
387 if (!SendDlgItemMessageA(hwnd, id, WM_GETTEXT, sizeof(str), (LPARAM)str))
388 return 0;
389
390 if (fSigned)
391 {
392 result = strtol( str, &endptr, 10 );
393 if (!endptr || (endptr == str)) /* Conversion was unsuccessful */
394 return 0;
395 if (((result == LONG_MIN) || (result == LONG_MAX)) && (errno==ERANGE))
396 return 0;
397 }
398 else
399 {
400 result = strtoul( str, &endptr, 10 );
401 if (!endptr || (endptr == str)) /* Conversion was unsuccessful */
402 return 0;
403 if ((result == ULONG_MAX) && (errno == ERANGE)) return 0;
404 }
405 if (translated) *translated = TRUE;
406 return (UINT)result;
407}
408//******************************************************************************
409//******************************************************************************
410HWND WIN32API GetNextDlgGroupItem( HWND hwnd, HWND hwndCtrl, BOOL fPrevious)
411{
412 Win32BaseWindow *window;
413
414 window = Win32BaseWindow::GetWindowFromHandle(hwnd);
415 if(!window) {
416 dprintf(("GetNextDlgGroupItem, window %x not found", hwnd));
417 SetLastError(ERROR_INVALID_WINDOW_HANDLE);
418 return 0;
419 }
420 dprintf(("USER32: GetNextDlgGroupItem\n"));
421 return window->getNextDlgGroupItem(hwndCtrl, fPrevious);
422}
423/***********************************************************************
424 * GetDialogBaseUnits (USER.243) (USER32.233)
425 */
426DWORD WIN32API GetDialogBaseUnits(void)
427{
428 return Win32Dialog::GetDialogBaseUnits();
429}
430//******************************************************************************
431//******************************************************************************
432INT WIN32API DlgDirListA(HWND hDlg, LPSTR spec, INT idLBox, INT idStatic, UINT attrib )
433{
434 return DIALOG_DlgDirList( hDlg, spec, idLBox, idStatic, attrib, FALSE );
435}
436//******************************************************************************
437//******************************************************************************
438int WIN32API DlgDirListW(HWND hDlg, LPWSTR spec, INT idLBox, INT idStatic, UINT attrib )
439{
440 return DIALOG_DlgDirListW( hDlg, spec, idLBox, idStatic, attrib, FALSE );
441}
442//******************************************************************************
443//******************************************************************************
444INT WIN32API DlgDirListComboBoxA(HWND hDlg, LPSTR spec, INT idCBox, INT idStatic, UINT attrib )
445{
446 return DIALOG_DlgDirList( hDlg, spec, idCBox, idStatic, attrib, TRUE );
447}
448//******************************************************************************
449//******************************************************************************
450INT WIN32API DlgDirListComboBoxW( HWND hDlg, LPWSTR spec, INT idCBox, INT idStatic, UINT attrib )
451{
452 return DIALOG_DlgDirListW( hDlg, spec, idCBox, idStatic, attrib, TRUE );
453}
454//******************************************************************************
455//******************************************************************************
456BOOL WIN32API DlgDirSelectComboBoxExA(HWND hwnd, LPSTR str, INT len, INT id )
457{
458 return DIALOG_DlgDirSelect( hwnd, str, len, id, TRUE, FALSE, TRUE );
459}
460//******************************************************************************
461//******************************************************************************
462BOOL WIN32API DlgDirSelectComboBoxExW(HWND hwnd, LPWSTR str, INT len, INT id)
463{
464 return DIALOG_DlgDirSelect( hwnd, (LPSTR)str, len, id, TRUE, TRUE, TRUE );
465}
466//******************************************************************************
467//******************************************************************************
468BOOL WIN32API DlgDirSelectExA(HWND hwnd, LPSTR str, INT len, INT id)
469{
470 return DIALOG_DlgDirSelect( hwnd, str, len, id, TRUE, FALSE, FALSE );
471}
472//******************************************************************************
473//******************************************************************************
474BOOL WIN32API DlgDirSelectExW(HWND hwnd, LPWSTR str, INT len, INT id)
475{
476 return DIALOG_DlgDirSelect( hwnd, (LPSTR)str, len, id, TRUE, TRUE, FALSE );
477}
478/**********************************************************************
479 * DIALOG_DlgDirSelect
480 *
481 * Helper function for DlgDirSelect*
482 */
483static BOOL DIALOG_DlgDirSelect( HWND hwnd, LPSTR str, INT len,
484 INT id, BOOL win32, BOOL unicode,
485 BOOL combo )
486{
487 char *buffer, *ptr;
488 INT item, size;
489 BOOL ret;
490 HWND listbox = GetDlgItem( hwnd, id );
491
492 if (!listbox) return FALSE;
493
494 item = SendMessageA(listbox, combo ? CB_GETCURSEL
495 : LB_GETCURSEL, 0, 0 );
496 if (item == LB_ERR) return FALSE;
497 size = SendMessageA(listbox, combo ? CB_GETLBTEXTLEN
498 : LB_GETTEXTLEN, 0, 0 );
499 if (size == LB_ERR) return FALSE;
500
501 if (!(buffer = (char *)malloc( size+1 ))) return FALSE;
502
503 SendMessageA( listbox, combo ? CB_GETLBTEXT : LB_GETTEXT,
504 item, (LPARAM)buffer );
505
506 if ((ret = (buffer[0] == '[')) != 0) /* drive or directory */
507 {
508 if (buffer[1] == '-') /* drive */
509 {
510 buffer[3] = ':';
511 buffer[4] = 0;
512 ptr = buffer + 2;
513 }
514 else
515 {
516 buffer[strlen(buffer)-1] = '\\';
517 ptr = buffer + 1;
518 }
519 }
520 else ptr = buffer;
521
522 if (unicode) lstrcpynAtoW( (LPWSTR)str, ptr, len );
523 else lstrcpynA( str, ptr, len );
524
525 free( buffer );
526 return ret;
527}
528
529
530/**********************************************************************
531 * DIALOG_DlgDirList
532 *
533 * Helper function for DlgDirList*
534 */
535static INT DIALOG_DlgDirList( HWND hDlg, LPSTR spec, INT idLBox,
536 INT idStatic, UINT attrib, BOOL combo )
537{
538 int drive;
539 HWND hwnd;
540 LPSTR orig_spec = spec;
541
542#define SENDMSG(msg,wparam,lparam) \
543 ((attrib & DDL_POSTMSGS) ? PostMessageA( hwnd, msg, wparam, lparam ) \
544 : SendMessageA( hwnd, msg, wparam, lparam ))
545
546 if (spec && spec[0] && (spec[1] == ':'))
547 {
548 drive = _toupper( spec[0] ) - 'A';
549 spec += 2;
550 if (!DRIVE_SetCurrentDrive( drive )) return FALSE;
551 }
552 else drive = DRIVE_GetCurrentDrive();
553
554 /* If the path exists and is a directory, chdir to it */
555 if (!spec || !spec[0] || DRIVE_Chdir( drive, spec )) spec = "*.*";
556 else
557 {
558 char *p, *p2;
559 p = spec;
560 if ((p2 = strrchr( p, '\\' )) != 0) p = p2;
561 if ((p2 = strrchr( p, '/' )) != 0) p = p2;
562 if (p != spec)
563 {
564 char sep = *p;
565 *p = 0;
566 if (!DRIVE_Chdir( drive, spec ))
567 {
568 *p = sep; /* Restore the original spec */
569 return FALSE;
570 }
571 spec = p + 1;
572 }
573 }
574
575 if (idLBox && ((hwnd = GetDlgItem( hDlg, idLBox )) != 0))
576 {
577 SENDMSG( combo ? CB_RESETCONTENT : LB_RESETCONTENT, 0, 0 );
578 if (attrib & DDL_DIRECTORY)
579 {
580 if (!(attrib & DDL_EXCLUSIVE))
581 {
582 if (SENDMSG( combo ? CB_DIR : LB_DIR,
583 attrib & ~(DDL_DIRECTORY | DDL_DRIVES),
584 (LPARAM)spec ) == LB_ERR)
585 return FALSE;
586 }
587 if (SENDMSG( combo ? CB_DIR : LB_DIR,
588 (attrib & (DDL_DIRECTORY | DDL_DRIVES)) | DDL_EXCLUSIVE,
589 (LPARAM)"*.*" ) == LB_ERR)
590 return FALSE;
591 }
592 else
593 {
594 if (SENDMSG( combo ? CB_DIR : LB_DIR, attrib,
595 (LPARAM)spec ) == LB_ERR)
596 return FALSE;
597 }
598 }
599
600 if (idStatic && ((hwnd = GetDlgItem( hDlg, idStatic )) != 0))
601 {
602 char temp[512], curpath[512];
603 int drive = DRIVE_GetCurrentDrive();
604 strcpy( temp, "A:\\" );
605 temp[0] += drive;
606 lstrcpynA( temp + 3, DRIVE_GetDosCwd(curpath, drive), sizeof(temp)-3 );
607 CharLowerA( temp );
608 /* Can't use PostMessage() here, because the string is on the stack */
609 SetDlgItemTextA( hDlg, idStatic, temp );
610 }
611
612 if (orig_spec && (spec != orig_spec))
613 {
614 /* Update the original file spec */
615 char *p = spec;
616 while ((*orig_spec++ = *p++) != 0);
617 }
618
619 return TRUE;
620#undef SENDMSG
621}
622
623
624/**********************************************************************
625 * DIALOG_DlgDirListW
626 *
627 * Helper function for DlgDirList*32W
628 */
629static INT DIALOG_DlgDirListW( HWND hDlg, LPWSTR spec, INT idLBox,
630 INT idStatic, UINT attrib, BOOL combo )
631{
632 if (spec)
633 {
634 LPSTR specA = HEAP_strdupWtoA( GetProcessHeap(), 0, spec );
635 INT ret = DIALOG_DlgDirList( hDlg, specA, idLBox, idStatic,
636 attrib, combo );
637 lstrcpyAtoW( spec, specA );
638 HeapFree( GetProcessHeap(), 0, specA );
639 return ret;
640 }
641 return DIALOG_DlgDirList( hDlg, NULL, idLBox, idStatic, attrib, combo );
642}
643//******************************************************************************
644//******************************************************************************
645
Note: See TracBrowser for help on using the repository browser.