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

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

more logging

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