Check when backtracking the stack if frames are correct (readable).
[wine/wine-kai.git] / windows / dialog.c
blob566f31fe3922d4694652fd8542e5548dadcb7164
1 /*
2 * Dialog functions
4 * Copyright 1993, 1994, 1996 Alexandre Julliard
5 */
7 #include <ctype.h>
8 #include <errno.h>
9 #include <limits.h>
10 #include <stdlib.h>
11 #include <string.h>
12 #include "winuser.h"
13 #include "wine/winuser16.h"
14 #include "wine/winbase16.h"
15 #include "dialog.h"
16 #include "drive.h"
17 #include "heap.h"
18 #include "win.h"
19 #include "ldt.h"
20 #include "user.h"
21 #include "winproc.h"
22 #include "message.h"
23 #include "debug.h"
25 DEFAULT_DEBUG_CHANNEL(dialog)
28 /* Dialog control information */
29 typedef struct
31 DWORD style;
32 DWORD exStyle;
33 DWORD helpId;
34 INT16 x;
35 INT16 y;
36 INT16 cx;
37 INT16 cy;
38 UINT id;
39 LPCSTR className;
40 LPCSTR windowName;
41 LPVOID data;
42 } DLG_CONTROL_INFO;
44 /* Dialog template */
45 typedef struct
47 DWORD style;
48 DWORD exStyle;
49 DWORD helpId;
50 UINT16 nbItems;
51 INT16 x;
52 INT16 y;
53 INT16 cx;
54 INT16 cy;
55 LPCSTR menuName;
56 LPCSTR className;
57 LPCSTR caption;
58 WORD pointSize;
59 WORD weight;
60 BOOL italic;
61 LPCSTR faceName;
62 BOOL dialogEx;
63 } DLG_TEMPLATE;
65 /* Dialog base units */
66 static WORD xBaseUnit = 0, yBaseUnit = 0;
69 /***********************************************************************
70 * DIALOG_Init
72 * Initialisation of the dialog manager.
74 BOOL DIALOG_Init(void)
76 TEXTMETRIC16 tm;
77 HDC16 hdc;
79 /* Calculate the dialog base units */
81 if (!(hdc = CreateDC16( "DISPLAY", NULL, NULL, NULL ))) return FALSE;
82 GetTextMetrics16( hdc, &tm );
83 DeleteDC( hdc );
84 xBaseUnit = tm.tmAveCharWidth;
85 yBaseUnit = tm.tmHeight;
87 /* Dialog units are based on a proportional system font */
88 /* so we adjust them a bit for a fixed font. */
89 if (!(tm.tmPitchAndFamily & TMPF_FIXED_PITCH))
90 xBaseUnit = xBaseUnit * 5 / 4;
92 TRACE(dialog, "base units = %d,%d\n",
93 xBaseUnit, yBaseUnit );
94 return TRUE;
98 /***********************************************************************
99 * DIALOG_GetControl16
101 * Return the class and text of the control pointed to by ptr,
102 * fill the header structure and return a pointer to the next control.
104 static LPCSTR DIALOG_GetControl16( LPCSTR p, DLG_CONTROL_INFO *info )
106 static char buffer[10];
107 int int_id;
109 info->x = GET_WORD(p); p += sizeof(WORD);
110 info->y = GET_WORD(p); p += sizeof(WORD);
111 info->cx = GET_WORD(p); p += sizeof(WORD);
112 info->cy = GET_WORD(p); p += sizeof(WORD);
113 info->id = GET_WORD(p); p += sizeof(WORD);
114 info->style = GET_DWORD(p); p += sizeof(DWORD);
115 info->exStyle = 0;
117 if (*p & 0x80)
119 switch((BYTE)*p)
121 case 0x80: strcpy( buffer, "BUTTON" ); break;
122 case 0x81: strcpy( buffer, "EDIT" ); break;
123 case 0x82: strcpy( buffer, "STATIC" ); break;
124 case 0x83: strcpy( buffer, "LISTBOX" ); break;
125 case 0x84: strcpy( buffer, "SCROLLBAR" ); break;
126 case 0x85: strcpy( buffer, "COMBOBOX" ); break;
127 default: buffer[0] = '\0'; break;
129 info->className = buffer;
130 p++;
132 else
134 info->className = p;
135 p += strlen(p) + 1;
138 int_id = ((BYTE)*p == 0xff);
139 if (int_id)
141 /* Integer id, not documented (?). Only works for SS_ICON controls */
142 info->windowName = (LPCSTR)(UINT)GET_WORD(p+1);
143 p += 3;
145 else
147 info->windowName = p;
148 p += strlen(p) + 1;
151 info->data = (LPVOID)(*p ? p + 1 : NULL); /* FIXME: should be a segptr */
152 p += *p + 1;
154 if(int_id)
155 TRACE(dialog," %s %04x %d, %d, %d, %d, %d, %08lx, %08lx\n",
156 info->className, LOWORD(info->windowName),
157 info->id, info->x, info->y, info->cx, info->cy,
158 info->style, (DWORD)info->data);
159 else
160 TRACE(dialog," %s '%s' %d, %d, %d, %d, %d, %08lx, %08lx\n",
161 info->className, info->windowName,
162 info->id, info->x, info->y, info->cx, info->cy,
163 info->style, (DWORD)info->data);
165 return p;
169 /***********************************************************************
170 * DIALOG_GetControl32
172 * Return the class and text of the control pointed to by ptr,
173 * fill the header structure and return a pointer to the next control.
175 static const WORD *DIALOG_GetControl32( const WORD *p, DLG_CONTROL_INFO *info,
176 BOOL dialogEx )
178 if (dialogEx)
180 info->helpId = GET_DWORD(p); p += 2;
181 info->exStyle = GET_DWORD(p); p += 2;
182 info->style = GET_DWORD(p); p += 2;
184 else
186 info->helpId = 0;
187 info->style = GET_DWORD(p); p += 2;
188 info->exStyle = GET_DWORD(p); p += 2;
190 info->x = GET_WORD(p); p++;
191 info->y = GET_WORD(p); p++;
192 info->cx = GET_WORD(p); p++;
193 info->cy = GET_WORD(p); p++;
195 if (dialogEx)
197 /* id is a DWORD for DIALOGEX */
198 info->id = GET_DWORD(p);
199 p += 2;
201 else
203 info->id = GET_WORD(p);
204 p++;
207 if (GET_WORD(p) == 0xffff)
209 static const WCHAR class_names[6][10] =
211 { 'B','u','t','t','o','n', }, /* 0x80 */
212 { 'E','d','i','t', }, /* 0x81 */
213 { 'S','t','a','t','i','c', }, /* 0x82 */
214 { 'L','i','s','t','B','o','x', }, /* 0x83 */
215 { 'S','c','r','o','l','l','B','a','r', }, /* 0x84 */
216 { 'C','o','m','b','o','B','o','x', } /* 0x85 */
218 WORD id = GET_WORD(p+1);
219 if ((id >= 0x80) && (id <= 0x85))
220 info->className = (LPCSTR)class_names[id - 0x80];
221 else
223 info->className = NULL;
224 ERR( dialog, "Unknown built-in class id %04x\n", id );
226 p += 2;
228 else
230 info->className = (LPCSTR)p;
231 p += lstrlenW( (LPCWSTR)p ) + 1;
234 if (GET_WORD(p) == 0xffff) /* Is it an integer id? */
236 info->windowName = (LPCSTR)(UINT)GET_WORD(p + 1);
237 p += 2;
239 else
241 info->windowName = (LPCSTR)p;
242 p += lstrlenW( (LPCWSTR)p ) + 1;
245 TRACE(dialog," %s %s %d, %d, %d, %d, %d, %08lx, %08lx, %08lx\n",
246 debugstr_w( (LPCWSTR)info->className ),
247 debugres_w( (LPCWSTR)info->windowName ),
248 info->id, info->x, info->y, info->cx, info->cy,
249 info->style, info->exStyle, info->helpId );
251 if (GET_WORD(p))
253 if (TRACE_ON(dialog))
255 WORD i, count = GET_WORD(p) / sizeof(WORD);
256 TRACE(dialog, " BEGIN\n");
257 TRACE(dialog, " ");
258 for (i = 0; i < count; i++) DUMP( "%04x,", GET_WORD(p+i+1) );
259 DUMP("\n");
260 TRACE(dialog, " END\n" );
262 info->data = (LPVOID)(p + 1);
263 p += GET_WORD(p) / sizeof(WORD);
265 else info->data = NULL;
266 p++;
268 /* Next control is on dword boundary */
269 return (const WORD *)((((int)p) + 3) & ~3);
273 /***********************************************************************
274 * DIALOG_CreateControls
276 * Create the control windows for a dialog.
278 static BOOL DIALOG_CreateControls( WND *pWnd, LPCSTR template,
279 const DLG_TEMPLATE *dlgTemplate,
280 HINSTANCE hInst, BOOL win32 )
282 DIALOGINFO *dlgInfo = (DIALOGINFO *)pWnd->wExtra;
283 DLG_CONTROL_INFO info;
284 HWND hwndCtrl, hwndDefButton = 0;
285 INT items = dlgTemplate->nbItems;
287 TRACE(dialog, " BEGIN\n" );
288 while (items--)
290 if (!win32)
292 HINSTANCE16 instance;
293 template = DIALOG_GetControl16( template, &info );
294 if (HIWORD(info.className) && !strcmp( info.className, "EDIT") &&
295 ((pWnd->dwStyle & DS_LOCALEDIT) != DS_LOCALEDIT))
297 if (!dlgInfo->hDialogHeap)
299 dlgInfo->hDialogHeap = GlobalAlloc16(GMEM_FIXED, 0x10000);
300 if (!dlgInfo->hDialogHeap)
302 ERR(dialog, "Insufficient memory to create heap for edit control\n" );
303 continue;
305 LocalInit16(dlgInfo->hDialogHeap, 0, 0xffff);
307 instance = dlgInfo->hDialogHeap;
309 else instance = (HINSTANCE16)hInst;
311 hwndCtrl = CreateWindowEx16( info.exStyle | WS_EX_NOPARENTNOTIFY,
312 info.className, info.windowName,
313 info.style | WS_CHILD,
314 info.x * dlgInfo->xBaseUnit / 4,
315 info.y * dlgInfo->yBaseUnit / 8,
316 info.cx * dlgInfo->xBaseUnit / 4,
317 info.cy * dlgInfo->yBaseUnit / 8,
318 pWnd->hwndSelf, (HMENU16)info.id,
319 instance, info.data );
321 else
323 template = (LPCSTR)DIALOG_GetControl32( (WORD *)template, &info,
324 dlgTemplate->dialogEx );
325 hwndCtrl = CreateWindowExW( info.exStyle | WS_EX_NOPARENTNOTIFY,
326 (LPCWSTR)info.className,
327 (LPCWSTR)info.windowName,
328 info.style | WS_CHILD,
329 info.x * dlgInfo->xBaseUnit / 4,
330 info.y * dlgInfo->yBaseUnit / 8,
331 info.cx * dlgInfo->xBaseUnit / 4,
332 info.cy * dlgInfo->yBaseUnit / 8,
333 pWnd->hwndSelf, (HMENU)info.id,
334 hInst, info.data );
336 if (!hwndCtrl) return FALSE;
338 /* Send initialisation messages to the control */
339 if (dlgInfo->hUserFont) SendMessageA( hwndCtrl, WM_SETFONT,
340 (WPARAM)dlgInfo->hUserFont, 0 );
341 if (SendMessageA(hwndCtrl, WM_GETDLGCODE, 0, 0) & DLGC_DEFPUSHBUTTON)
343 /* If there's already a default push-button, set it back */
344 /* to normal and use this one instead. */
345 if (hwndDefButton)
346 SendMessageA( hwndDefButton, BM_SETSTYLE,
347 BS_PUSHBUTTON,FALSE );
348 hwndDefButton = hwndCtrl;
349 dlgInfo->idResult = GetWindowWord( hwndCtrl, GWW_ID );
352 TRACE(dialog, " END\n" );
353 return TRUE;
357 /***********************************************************************
358 * DIALOG_ParseTemplate16
360 * Fill a DLG_TEMPLATE structure from the dialog template, and return
361 * a pointer to the first control.
363 static LPCSTR DIALOG_ParseTemplate16( LPCSTR p, DLG_TEMPLATE * result )
365 result->style = GET_DWORD(p); p += sizeof(DWORD);
366 result->exStyle = 0;
367 result->nbItems = *p++;
368 result->x = GET_WORD(p); p += sizeof(WORD);
369 result->y = GET_WORD(p); p += sizeof(WORD);
370 result->cx = GET_WORD(p); p += sizeof(WORD);
371 result->cy = GET_WORD(p); p += sizeof(WORD);
372 TRACE(dialog, "DIALOG %d, %d, %d, %d\n",
373 result->x, result->y, result->cx, result->cy );
374 TRACE(dialog, " STYLE %08lx\n", result->style );
376 /* Get the menu name */
378 switch( (BYTE)*p )
380 case 0:
381 result->menuName = 0;
382 p++;
383 break;
384 case 0xff:
385 result->menuName = (LPCSTR)(UINT)GET_WORD( p + 1 );
386 p += 3;
387 TRACE(dialog, " MENU %04x\n", LOWORD(result->menuName) );
388 break;
389 default:
390 result->menuName = p;
391 TRACE(dialog, " MENU '%s'\n", p );
392 p += strlen(p) + 1;
393 break;
396 /* Get the class name */
398 if (*p)
400 result->className = p;
401 TRACE(dialog, " CLASS '%s'\n", result->className );
403 else result->className = DIALOG_CLASS_ATOM;
404 p += strlen(p) + 1;
406 /* Get the window caption */
408 result->caption = p;
409 p += strlen(p) + 1;
410 TRACE(dialog, " CAPTION '%s'\n", result->caption );
412 /* Get the font name */
414 if (result->style & DS_SETFONT)
416 result->pointSize = GET_WORD(p);
417 p += sizeof(WORD);
418 result->faceName = p;
419 p += strlen(p) + 1;
420 TRACE(dialog, " FONT %d,'%s'\n",
421 result->pointSize, result->faceName );
423 return p;
427 /***********************************************************************
428 * DIALOG_ParseTemplate32
430 * Fill a DLG_TEMPLATE structure from the dialog template, and return
431 * a pointer to the first control.
433 static LPCSTR DIALOG_ParseTemplate32( LPCSTR template, DLG_TEMPLATE * result )
435 const WORD *p = (const WORD *)template;
437 result->style = GET_DWORD(p); p += 2;
438 if (result->style == 0xffff0001) /* DIALOGEX resource */
440 result->dialogEx = TRUE;
441 result->helpId = GET_DWORD(p); p += 2;
442 result->exStyle = GET_DWORD(p); p += 2;
443 result->style = GET_DWORD(p); p += 2;
445 else
447 result->dialogEx = FALSE;
448 result->helpId = 0;
449 result->exStyle = GET_DWORD(p); p += 2;
451 result->nbItems = GET_WORD(p); p++;
452 result->x = GET_WORD(p); p++;
453 result->y = GET_WORD(p); p++;
454 result->cx = GET_WORD(p); p++;
455 result->cy = GET_WORD(p); p++;
456 TRACE( dialog, "DIALOG%s %d, %d, %d, %d, %ld\n",
457 result->dialogEx ? "EX" : "", result->x, result->y,
458 result->cx, result->cy, result->helpId );
459 TRACE( dialog, " STYLE 0x%08lx\n", result->style );
460 TRACE( dialog, " EXSTYLE 0x%08lx\n", result->exStyle );
462 /* Get the menu name */
464 switch(GET_WORD(p))
466 case 0x0000:
467 result->menuName = NULL;
468 p++;
469 break;
470 case 0xffff:
471 result->menuName = (LPCSTR)(UINT)GET_WORD( p + 1 );
472 p += 2;
473 TRACE(dialog, " MENU %04x\n", LOWORD(result->menuName) );
474 break;
475 default:
476 result->menuName = (LPCSTR)p;
477 TRACE(dialog, " MENU %s\n", debugstr_w( (LPCWSTR)p ));
478 p += lstrlenW( (LPCWSTR)p ) + 1;
479 break;
482 /* Get the class name */
484 switch(GET_WORD(p))
486 case 0x0000:
487 result->className = DIALOG_CLASS_ATOM;
488 p++;
489 break;
490 case 0xffff:
491 result->className = (LPCSTR)(UINT)GET_WORD( p + 1 );
492 p += 2;
493 TRACE(dialog, " CLASS %04x\n", LOWORD(result->className) );
494 break;
495 default:
496 result->className = (LPCSTR)p;
497 TRACE(dialog, " CLASS %s\n", debugstr_w( (LPCWSTR)p ));
498 p += lstrlenW( (LPCWSTR)p ) + 1;
499 break;
502 /* Get the window caption */
504 result->caption = (LPCSTR)p;
505 p += lstrlenW( (LPCWSTR)p ) + 1;
506 TRACE(dialog, " CAPTION %s\n", debugstr_w( (LPCWSTR)result->caption ) );
508 /* Get the font name */
510 if (result->style & DS_SETFONT)
512 result->pointSize = GET_WORD(p);
513 p++;
514 if (result->dialogEx)
516 result->weight = GET_WORD(p); p++;
517 result->italic = LOBYTE(GET_WORD(p)); p++;
519 else
521 result->weight = FW_DONTCARE;
522 result->italic = FALSE;
524 result->faceName = (LPCSTR)p;
525 p += lstrlenW( (LPCWSTR)p ) + 1;
526 TRACE(dialog, " FONT %d, %s, %d, %s\n",
527 result->pointSize, debugstr_w( (LPCWSTR)result->faceName ),
528 result->weight, result->italic ? "TRUE" : "FALSE" );
531 /* First control is on dword boundary */
532 return (LPCSTR)((((int)p) + 3) & ~3);
536 /***********************************************************************
537 * DIALOG_CreateIndirect
539 HWND DIALOG_CreateIndirect( HINSTANCE hInst, LPCSTR dlgTemplate,
540 BOOL win32Template, HWND owner,
541 DLGPROC16 dlgProc, LPARAM param,
542 WINDOWPROCTYPE procType )
544 HMENU16 hMenu = 0;
545 HFONT16 hFont = 0;
546 HWND hwnd;
547 RECT rect;
548 WND * wndPtr;
549 DLG_TEMPLATE template;
550 DIALOGINFO * dlgInfo;
551 WORD xUnit = xBaseUnit;
552 WORD yUnit = yBaseUnit;
554 /* Parse dialog template */
556 if (!dlgTemplate) return 0;
557 if (win32Template)
558 dlgTemplate = DIALOG_ParseTemplate32( dlgTemplate, &template );
559 else
560 dlgTemplate = DIALOG_ParseTemplate16( dlgTemplate, &template );
562 /* Load menu */
564 if (template.menuName)
566 if (!win32Template)
568 LPSTR str = SEGPTR_STRDUP( template.menuName );
569 hMenu = LoadMenu16( hInst, SEGPTR_GET(str) );
570 SEGPTR_FREE( str );
572 else hMenu = LoadMenuW( hInst, (LPCWSTR)template.menuName );
575 /* Create custom font if needed */
577 if (template.style & DS_SETFONT)
579 /* The font height must be negative as it is a point size */
580 /* (see CreateFont() documentation in the Windows SDK). */
582 if (win32Template)
583 hFont = CreateFontW( -template.pointSize, 0, 0, 0,
584 template.weight, template.italic, FALSE,
585 FALSE, DEFAULT_CHARSET, 0, 0, PROOF_QUALITY,
586 FF_DONTCARE, (LPCWSTR)template.faceName );
587 else
588 hFont = CreateFont16( -template.pointSize, 0, 0, 0, FW_DONTCARE,
589 FALSE, FALSE, FALSE, DEFAULT_CHARSET, 0, 0,
590 PROOF_QUALITY, FF_DONTCARE,
591 template.faceName );
592 if (hFont)
594 TEXTMETRIC16 tm;
595 HFONT16 oldFont;
597 HDC hdc = GetDC(0);
598 oldFont = SelectObject( hdc, hFont );
599 GetTextMetrics16( hdc, &tm );
600 SelectObject( hdc, oldFont );
601 ReleaseDC( 0, hdc );
602 xUnit = tm.tmAveCharWidth;
603 yUnit = tm.tmHeight;
604 if (!(tm.tmPitchAndFamily & TMPF_FIXED_PITCH))
605 xBaseUnit = xBaseUnit * 5 / 4; /* See DIALOG_Init() */
609 /* Create dialog main window */
611 rect.left = rect.top = 0;
612 rect.right = template.cx * xUnit / 4;
613 rect.bottom = template.cy * yUnit / 8;
614 if (template.style & DS_MODALFRAME)
615 template.exStyle |= WS_EX_DLGMODALFRAME;
616 AdjustWindowRectEx( &rect, template.style,
617 hMenu ? TRUE : FALSE , template.exStyle );
618 rect.right -= rect.left;
619 rect.bottom -= rect.top;
621 if ((INT16)template.x == CW_USEDEFAULT16)
623 rect.left = rect.top = (procType == WIN_PROC_16) ? CW_USEDEFAULT16
624 : CW_USEDEFAULT;
626 else
628 if (template.style & DS_CENTER)
630 rect.left = (GetSystemMetrics(SM_CXSCREEN) - rect.right) / 2;
631 rect.top = (GetSystemMetrics(SM_CYSCREEN) - rect.bottom) / 2;
633 else
635 rect.left += template.x * xUnit / 4;
636 rect.top += template.y * yUnit / 8;
638 if ( !(template.style & WS_CHILD) )
640 INT16 dX, dY;
642 if( !(template.style & DS_ABSALIGN) )
643 ClientToScreen( owner, (POINT *)&rect );
645 /* try to fit it into the desktop */
647 if( (dX = rect.left + rect.right + GetSystemMetrics(SM_CXDLGFRAME)
648 - GetSystemMetrics(SM_CXSCREEN)) > 0 ) rect.left -= dX;
649 if( (dY = rect.top + rect.bottom + GetSystemMetrics(SM_CYDLGFRAME)
650 - GetSystemMetrics(SM_CYSCREEN)) > 0 ) rect.top -= dY;
651 if( rect.left < 0 ) rect.left = 0;
652 if( rect.top < 0 ) rect.top = 0;
656 if (procType == WIN_PROC_16)
657 hwnd = CreateWindowEx16(template.exStyle, template.className,
658 template.caption, template.style & ~WS_VISIBLE,
659 rect.left, rect.top, rect.right, rect.bottom,
660 owner, hMenu, hInst, NULL );
661 else
662 hwnd = CreateWindowExW(template.exStyle, (LPCWSTR)template.className,
663 (LPCWSTR)template.caption,
664 template.style & ~WS_VISIBLE,
665 rect.left, rect.top, rect.right, rect.bottom,
666 owner, hMenu, hInst, NULL );
668 if (!hwnd)
670 if (hFont) DeleteObject( hFont );
671 if (hMenu) DestroyMenu( hMenu );
672 return 0;
674 wndPtr = WIN_FindWndPtr( hwnd );
675 wndPtr->flags |= WIN_ISDIALOG;
676 wndPtr->helpContext = template.helpId;
678 /* Initialise dialog extra data */
680 dlgInfo = (DIALOGINFO *)wndPtr->wExtra;
681 WINPROC_SetProc( &dlgInfo->dlgProc, (WNDPROC16)dlgProc, procType, WIN_PROC_WINDOW );
682 dlgInfo->hUserFont = hFont;
683 dlgInfo->hMenu = hMenu;
684 dlgInfo->xBaseUnit = xUnit;
685 dlgInfo->yBaseUnit = yUnit;
686 dlgInfo->msgResult = 0;
687 dlgInfo->idResult = 0;
688 dlgInfo->flags = 0;
689 dlgInfo->hDialogHeap = 0;
691 if (dlgInfo->hUserFont)
692 SendMessageA( hwnd, WM_SETFONT, (WPARAM)dlgInfo->hUserFont, 0 );
694 /* Create controls */
696 if (DIALOG_CreateControls( wndPtr, dlgTemplate, &template,
697 hInst, win32Template ))
699 /* Send initialisation messages and set focus */
701 dlgInfo->hwndFocus = GetNextDlgTabItem( hwnd, 0, FALSE );
703 if (SendMessageA( hwnd, WM_INITDIALOG, (WPARAM)dlgInfo->hwndFocus, param ))
704 SetFocus( dlgInfo->hwndFocus );
706 if (template.style & WS_VISIBLE && !(wndPtr->dwStyle & WS_VISIBLE))
708 ShowWindow( hwnd, SW_SHOWNORMAL ); /* SW_SHOW doesn't always work */
709 UpdateWindow( hwnd );
711 WIN_ReleaseWndPtr(wndPtr);
712 return hwnd;
714 WIN_ReleaseWndPtr(wndPtr);
715 if( IsWindow(hwnd) ) DestroyWindow( hwnd );
716 return 0;
720 /***********************************************************************
721 * CreateDialog16 (USER.89)
723 HWND16 WINAPI CreateDialog16( HINSTANCE16 hInst, SEGPTR dlgTemplate,
724 HWND16 owner, DLGPROC16 dlgProc )
726 return CreateDialogParam16( hInst, dlgTemplate, owner, dlgProc, 0 );
730 /***********************************************************************
731 * CreateDialogParam16 (USER.241)
733 HWND16 WINAPI CreateDialogParam16( HINSTANCE16 hInst, SEGPTR dlgTemplate,
734 HWND16 owner, DLGPROC16 dlgProc,
735 LPARAM param )
737 HWND16 hwnd = 0;
738 HRSRC16 hRsrc;
739 HGLOBAL16 hmem;
740 LPCVOID data;
742 TRACE(dialog, "%04x,%08lx,%04x,%08lx,%ld\n",
743 hInst, (DWORD)dlgTemplate, owner, (DWORD)dlgProc, param );
745 if (!(hRsrc = FindResource16( hInst, dlgTemplate, RT_DIALOG16 ))) return 0;
746 if (!(hmem = LoadResource16( hInst, hRsrc ))) return 0;
747 if (!(data = LockResource16( hmem ))) hwnd = 0;
748 else hwnd = CreateDialogIndirectParam16( hInst, data, owner,
749 dlgProc, param );
750 FreeResource16( hmem );
751 return hwnd;
754 /***********************************************************************
755 * CreateDialogParam32A (USER32.73)
757 HWND WINAPI CreateDialogParamA( HINSTANCE hInst, LPCSTR name,
758 HWND owner, DLGPROC dlgProc,
759 LPARAM param )
761 if (HIWORD(name))
763 LPWSTR str = HEAP_strdupAtoW( GetProcessHeap(), 0, name );
764 HWND hwnd = CreateDialogParamW( hInst, str, owner, dlgProc, param);
765 HeapFree( GetProcessHeap(), 0, str );
766 return hwnd;
768 return CreateDialogParamW( hInst, (LPCWSTR)name, owner, dlgProc, param );
772 /***********************************************************************
773 * CreateDialogParam32W (USER32.74)
775 HWND WINAPI CreateDialogParamW( HINSTANCE hInst, LPCWSTR name,
776 HWND owner, DLGPROC dlgProc,
777 LPARAM param )
779 HANDLE hrsrc = FindResourceW( hInst, name, RT_DIALOGW );
780 if (!hrsrc) return 0;
781 return CreateDialogIndirectParamW( hInst,
782 (LPVOID)LoadResource(hInst, hrsrc),
783 owner, dlgProc, param );
787 /***********************************************************************
788 * CreateDialogIndirect16 (USER.219)
790 HWND16 WINAPI CreateDialogIndirect16( HINSTANCE16 hInst, LPCVOID dlgTemplate,
791 HWND16 owner, DLGPROC16 dlgProc )
793 return CreateDialogIndirectParam16( hInst, dlgTemplate, owner, dlgProc, 0);
797 /***********************************************************************
798 * CreateDialogIndirectParam16 (USER.242)
800 HWND16 WINAPI CreateDialogIndirectParam16( HINSTANCE16 hInst,
801 LPCVOID dlgTemplate,
802 HWND16 owner, DLGPROC16 dlgProc,
803 LPARAM param )
805 return DIALOG_CreateIndirect( hInst, dlgTemplate, FALSE, owner,
806 dlgProc, param, WIN_PROC_16 );
810 /***********************************************************************
811 * CreateDialogIndirectParam32A (USER32.69)
813 HWND WINAPI CreateDialogIndirectParamA( HINSTANCE hInst,
814 LPCVOID dlgTemplate,
815 HWND owner, DLGPROC dlgProc,
816 LPARAM param )
818 return DIALOG_CreateIndirect( hInst, dlgTemplate, TRUE, owner,
819 (DLGPROC16)dlgProc, param, WIN_PROC_32A );
822 /***********************************************************************
823 * CreateDialogIndirectParam32AorW (USER32.71)
825 HWND WINAPI CreateDialogIndirectParamAorW( HINSTANCE hInst,
826 LPCVOID dlgTemplate,
827 HWND owner, DLGPROC dlgProc,
828 LPARAM param )
829 { FIXME(dialog,"assume WIN_PROC_32W\n");
830 return DIALOG_CreateIndirect( hInst, dlgTemplate, TRUE, owner,
831 (DLGPROC16)dlgProc, param, WIN_PROC_32W );
834 /***********************************************************************
835 * CreateDialogIndirectParam32W (USER32.72)
837 HWND WINAPI CreateDialogIndirectParamW( HINSTANCE hInst,
838 LPCVOID dlgTemplate,
839 HWND owner, DLGPROC dlgProc,
840 LPARAM param )
842 return DIALOG_CreateIndirect( hInst, dlgTemplate, TRUE, owner,
843 (DLGPROC16)dlgProc, param, WIN_PROC_32W );
847 /***********************************************************************
848 * DIALOG_DoDialogBox
850 INT DIALOG_DoDialogBox( HWND hwnd, HWND owner )
852 WND * wndPtr;
853 DIALOGINFO * dlgInfo;
854 MSG msg;
855 INT retval;
857 /* Owner must be a top-level window */
858 owner = WIN_GetTopParent( owner );
859 if (!(wndPtr = WIN_FindWndPtr( hwnd ))) return -1;
860 dlgInfo = (DIALOGINFO *)wndPtr->wExtra;
862 if (!dlgInfo->flags & DF_END) /* was EndDialog called in WM_INITDIALOG ? */
864 EnableWindow( owner, FALSE );
865 ShowWindow( hwnd, SW_SHOW );
866 while (MSG_InternalGetMessage(&msg, hwnd, owner, MSGF_DIALOGBOX,
867 PM_REMOVE, !(wndPtr->dwStyle & DS_NOIDLEMSG) ))
869 if (!IsDialogMessageA( hwnd, &msg))
871 TranslateMessage( &msg );
872 DispatchMessageA( &msg );
874 if (dlgInfo->flags & DF_END) break;
876 EnableWindow( owner, TRUE );
878 retval = dlgInfo->idResult;
879 WIN_ReleaseWndPtr(wndPtr);
880 DestroyWindow( hwnd );
881 return retval;
885 /***********************************************************************
886 * DialogBox16 (USER.87)
888 INT16 WINAPI DialogBox16( HINSTANCE16 hInst, SEGPTR dlgTemplate,
889 HWND16 owner, DLGPROC16 dlgProc )
891 return DialogBoxParam16( hInst, dlgTemplate, owner, dlgProc, 0 );
895 /***********************************************************************
896 * DialogBoxParam16 (USER.239)
898 INT16 WINAPI DialogBoxParam16( HINSTANCE16 hInst, SEGPTR template,
899 HWND16 owner, DLGPROC16 dlgProc, LPARAM param )
901 HWND16 hwnd = CreateDialogParam16( hInst, template, owner, dlgProc, param);
902 if (hwnd) return (INT16)DIALOG_DoDialogBox( hwnd, owner );
903 return -1;
907 /***********************************************************************
908 * DialogBoxParam32A (USER32.139)
910 INT WINAPI DialogBoxParamA( HINSTANCE hInst, LPCSTR name,
911 HWND owner, DLGPROC dlgProc, LPARAM param )
913 HWND hwnd = CreateDialogParamA( hInst, name, owner, dlgProc, param );
914 if (hwnd) return DIALOG_DoDialogBox( hwnd, owner );
915 return -1;
919 /***********************************************************************
920 * DialogBoxParam32W (USER32.140)
922 INT WINAPI DialogBoxParamW( HINSTANCE hInst, LPCWSTR name,
923 HWND owner, DLGPROC dlgProc, LPARAM param )
925 HWND hwnd = CreateDialogParamW( hInst, name, owner, dlgProc, param );
926 if (hwnd) return DIALOG_DoDialogBox( hwnd, owner );
927 return -1;
931 /***********************************************************************
932 * DialogBoxIndirect16 (USER.218)
934 INT16 WINAPI DialogBoxIndirect16( HINSTANCE16 hInst, HANDLE16 dlgTemplate,
935 HWND16 owner, DLGPROC16 dlgProc )
937 return DialogBoxIndirectParam16( hInst, dlgTemplate, owner, dlgProc, 0 );
941 /***********************************************************************
942 * DialogBoxIndirectParam16 (USER.240)
944 INT16 WINAPI DialogBoxIndirectParam16( HINSTANCE16 hInst, HANDLE16 dlgTemplate,
945 HWND16 owner, DLGPROC16 dlgProc,
946 LPARAM param )
948 HWND16 hwnd;
949 LPCVOID ptr;
951 if (!(ptr = GlobalLock16( dlgTemplate ))) return -1;
952 hwnd = CreateDialogIndirectParam16( hInst, ptr, owner, dlgProc, param );
953 GlobalUnlock16( dlgTemplate );
954 if (hwnd) return (INT16)DIALOG_DoDialogBox( hwnd, owner );
955 return -1;
959 /***********************************************************************
960 * DialogBoxIndirectParam32A (USER32.136)
962 INT WINAPI DialogBoxIndirectParamA(HINSTANCE hInstance, LPCVOID template,
963 HWND owner, DLGPROC dlgProc,
964 LPARAM param )
966 HWND hwnd = CreateDialogIndirectParamA( hInstance, template,
967 owner, dlgProc, param );
968 if (hwnd) return DIALOG_DoDialogBox( hwnd, owner );
969 return -1;
973 /***********************************************************************
974 * DialogBoxIndirectParam32W (USER32.138)
976 INT WINAPI DialogBoxIndirectParamW(HINSTANCE hInstance, LPCVOID template,
977 HWND owner, DLGPROC dlgProc,
978 LPARAM param )
980 HWND hwnd = CreateDialogIndirectParamW( hInstance, template,
981 owner, dlgProc, param );
982 if (hwnd) return DIALOG_DoDialogBox( hwnd, owner );
983 return -1;
987 /***********************************************************************
988 * EndDialog16 (USER.88)
990 BOOL16 WINAPI EndDialog16( HWND16 hwnd, INT16 retval )
992 return EndDialog( hwnd, retval );
996 /***********************************************************************
997 * EndDialog32 (USER32.173)
999 BOOL WINAPI EndDialog( HWND hwnd, INT retval )
1001 WND * wndPtr = WIN_FindWndPtr( hwnd );
1002 DIALOGINFO * dlgInfo = (DIALOGINFO *)wndPtr->wExtra;
1004 TRACE(dialog, "%04x %d\n", hwnd, retval );
1006 if( dlgInfo )
1008 dlgInfo->idResult = retval;
1009 dlgInfo->flags |= DF_END;
1012 /* Paint Shop Pro 4.14 calls EndDialog for a CreateDialog* dialog,
1013 * which isn't "normal". Only DialogBox* dialogs may be EndDialog()ed.
1014 * Just hide the window as windows does it...
1016 ShowWindow(hwnd, SW_HIDE);
1018 WIN_ReleaseWndPtr(wndPtr);
1019 return TRUE;
1023 /***********************************************************************
1024 * DIALOG_IsAccelerator
1026 static BOOL DIALOG_IsAccelerator( HWND hwnd, HWND hwndDlg, WPARAM vKey )
1028 HWND hwndControl = hwnd;
1029 HWND hwndNext;
1030 WND *wndPtr;
1031 BOOL RetVal = FALSE;
1032 INT dlgCode;
1034 if (vKey == VK_SPACE)
1036 dlgCode = SendMessageA( hwndControl, WM_GETDLGCODE, 0, 0 );
1037 if (dlgCode & DLGC_BUTTON)
1039 SendMessageA( hwndControl, WM_LBUTTONDOWN, 0, 0);
1040 SendMessageA( hwndControl, WM_LBUTTONUP, 0, 0);
1041 RetVal = TRUE;
1044 else
1048 wndPtr = WIN_FindWndPtr( hwndControl );
1049 if ( (wndPtr != NULL) &&
1050 ((wndPtr->dwStyle & (WS_VISIBLE | WS_DISABLED)) == WS_VISIBLE) )
1052 dlgCode = SendMessageA( hwndControl, WM_GETDLGCODE, 0, 0 );
1053 if ( (dlgCode & (DLGC_BUTTON | DLGC_STATIC)) &&
1054 (wndPtr->text!=NULL))
1056 /* find the accelerator key */
1057 LPSTR p = wndPtr->text - 2;
1060 p = strchr( p + 2, '&' );
1062 while (p != NULL && p[1] == '&');
1064 /* and check if it's the one we're looking for */
1065 if (p != NULL && toupper( p[1] ) == toupper( vKey ) )
1067 if ((dlgCode & DLGC_STATIC) ||
1068 (wndPtr->dwStyle & 0x0f) == BS_GROUPBOX )
1070 /* set focus to the control */
1071 SendMessageA( hwndDlg, WM_NEXTDLGCTL,
1072 hwndControl, 1);
1073 /* and bump it on to next */
1074 SendMessageA( hwndDlg, WM_NEXTDLGCTL, 0, 0);
1076 else if (dlgCode &
1077 (DLGC_DEFPUSHBUTTON | DLGC_UNDEFPUSHBUTTON))
1079 /* send command message as from the control */
1080 SendMessageA( hwndDlg, WM_COMMAND,
1081 MAKEWPARAM( LOWORD(wndPtr->wIDmenu),
1082 BN_CLICKED ),
1083 (LPARAM)hwndControl );
1085 else
1087 /* click the control */
1088 SendMessageA( hwndControl, WM_LBUTTONDOWN, 0, 0);
1089 SendMessageA( hwndControl, WM_LBUTTONUP, 0, 0);
1091 RetVal = TRUE;
1092 break;
1095 hwndNext = GetWindow( hwndControl, GW_CHILD );
1097 else
1099 hwndNext = 0;
1101 WIN_ReleaseWndPtr(wndPtr);
1102 if (!hwndNext)
1104 hwndNext = GetWindow( hwndControl, GW_HWNDNEXT );
1106 while (!hwndNext)
1108 hwndControl = GetParent( hwndControl );
1109 if (hwndControl == hwndDlg)
1111 hwndNext = GetWindow( hwndDlg, GW_CHILD );
1113 else
1115 hwndNext = GetWindow( hwndControl, GW_HWNDNEXT );
1118 hwndControl = hwndNext;
1120 while (hwndControl != hwnd);
1122 return RetVal;
1126 /***********************************************************************
1127 * DIALOG_IsDialogMessage
1129 static BOOL DIALOG_IsDialogMessage( HWND hwnd, HWND hwndDlg,
1130 UINT message, WPARAM wParam,
1131 LPARAM lParam, BOOL *translate,
1132 BOOL *dispatch, INT dlgCode )
1134 *translate = *dispatch = FALSE;
1136 if (message == WM_PAINT)
1138 /* Apparently, we have to handle this one as well */
1139 *dispatch = TRUE;
1140 return TRUE;
1143 /* Only the key messages get special processing */
1144 if ((message != WM_KEYDOWN) &&
1145 (message != WM_SYSCHAR) &&
1146 (message != WM_CHAR))
1147 return FALSE;
1149 if (dlgCode & DLGC_WANTMESSAGE)
1151 *translate = *dispatch = TRUE;
1152 return TRUE;
1155 switch(message)
1157 case WM_KEYDOWN:
1158 switch(wParam)
1160 case VK_TAB:
1161 if (!(dlgCode & DLGC_WANTTAB))
1163 SendMessageA( hwndDlg, WM_NEXTDLGCTL,
1164 (GetKeyState(VK_SHIFT) & 0x8000), 0 );
1165 return TRUE;
1167 break;
1169 case VK_RIGHT:
1170 case VK_DOWN:
1171 case VK_LEFT:
1172 case VK_UP:
1173 if (!(dlgCode & DLGC_WANTARROWS))
1175 BOOL fPrevious = (wParam == VK_LEFT || wParam == VK_UP);
1176 HWND hwndNext =
1177 GetNextDlgGroupItem (hwndDlg, GetFocus(), fPrevious );
1178 SendMessageA( hwndDlg, WM_NEXTDLGCTL, hwndNext, 1 );
1179 return TRUE;
1181 break;
1183 case VK_ESCAPE:
1184 SendMessageA( hwndDlg, WM_COMMAND, IDCANCEL,
1185 (LPARAM)GetDlgItem( hwndDlg, IDCANCEL ) );
1186 return TRUE;
1188 case VK_RETURN:
1190 DWORD dw = SendMessage16( hwndDlg, DM_GETDEFID, 0, 0 );
1191 if (HIWORD(dw) == DC_HASDEFID)
1193 SendMessageA( hwndDlg, WM_COMMAND,
1194 MAKEWPARAM( LOWORD(dw), BN_CLICKED ),
1195 (LPARAM)GetDlgItem(hwndDlg, LOWORD(dw)));
1197 else
1199 SendMessageA( hwndDlg, WM_COMMAND, IDOK,
1200 (LPARAM)GetDlgItem( hwndDlg, IDOK ) );
1204 return TRUE;
1206 *translate = TRUE;
1207 break; /* case WM_KEYDOWN */
1209 case WM_CHAR:
1210 if (dlgCode & DLGC_WANTCHARS) break;
1211 /* drop through */
1213 case WM_SYSCHAR:
1214 if (DIALOG_IsAccelerator( hwnd, hwndDlg, wParam ))
1216 /* don't translate or dispatch */
1217 return TRUE;
1219 break;
1222 /* If we get here, the message has not been treated specially */
1223 /* and can be sent to its destination window. */
1224 *dispatch = TRUE;
1225 return TRUE;
1229 /***********************************************************************
1230 * IsDialogMessage16 (USER.90)
1232 BOOL16 WINAPI WIN16_IsDialogMessage16( HWND16 hwndDlg, SEGPTR msg16 )
1234 LPMSG16 msg = PTR_SEG_TO_LIN(msg16);
1235 BOOL ret, translate, dispatch;
1236 INT dlgCode;
1238 if ((hwndDlg != msg->hwnd) && !IsChild16( hwndDlg, msg->hwnd ))
1239 return FALSE;
1241 dlgCode = SendMessage16( msg->hwnd, WM_GETDLGCODE, 0, (LPARAM)msg16);
1242 ret = DIALOG_IsDialogMessage( msg->hwnd, hwndDlg, msg->message,
1243 msg->wParam, msg->lParam,
1244 &translate, &dispatch, dlgCode );
1245 if (translate) TranslateMessage16( msg );
1246 if (dispatch) DispatchMessage16( msg );
1247 return ret;
1251 BOOL16 WINAPI IsDialogMessage16( HWND16 hwndDlg, LPMSG16 msg )
1253 LPMSG16 msg16 = SEGPTR_NEW(MSG16);
1254 BOOL ret;
1256 *msg16 = *msg;
1257 ret = WIN16_IsDialogMessage16( hwndDlg, SEGPTR_GET(msg16) );
1258 SEGPTR_FREE(msg16);
1259 return ret;
1262 /***********************************************************************
1263 * IsDialogMessage32A (USER32.342)
1265 BOOL WINAPI IsDialogMessageA( HWND hwndDlg, LPMSG msg )
1267 BOOL ret, translate, dispatch;
1268 INT dlgCode;
1270 if ((hwndDlg != msg->hwnd) && !IsChild( hwndDlg, msg->hwnd ))
1271 return FALSE;
1273 dlgCode = SendMessageA( msg->hwnd, WM_GETDLGCODE, 0, (LPARAM)msg);
1274 ret = DIALOG_IsDialogMessage( msg->hwnd, hwndDlg, msg->message,
1275 msg->wParam, msg->lParam,
1276 &translate, &dispatch, dlgCode );
1277 if (translate) TranslateMessage( msg );
1278 if (dispatch) DispatchMessageA( msg );
1279 return ret;
1283 /***********************************************************************
1284 * IsDialogMessage32W (USER32.343)
1286 BOOL WINAPI IsDialogMessageW( HWND hwndDlg, LPMSG msg )
1288 BOOL ret, translate, dispatch;
1289 INT dlgCode;
1291 if ((hwndDlg != msg->hwnd) && !IsChild( hwndDlg, msg->hwnd ))
1292 return FALSE;
1294 dlgCode = SendMessageW( msg->hwnd, WM_GETDLGCODE, 0, (LPARAM)msg);
1295 ret = DIALOG_IsDialogMessage( msg->hwnd, hwndDlg, msg->message,
1296 msg->wParam, msg->lParam,
1297 &translate, &dispatch, dlgCode );
1298 if (translate) TranslateMessage( msg );
1299 if (dispatch) DispatchMessageW( msg );
1300 return ret;
1304 /****************************************************************
1305 * GetDlgCtrlID16 (USER.277)
1307 INT16 WINAPI GetDlgCtrlID16( HWND16 hwnd )
1309 WND *wndPtr = WIN_FindWndPtr(hwnd);
1310 INT16 retvalue;
1312 if (!wndPtr) return 0;
1314 retvalue = wndPtr->wIDmenu;
1315 WIN_ReleaseWndPtr(wndPtr);
1316 return retvalue;
1320 /****************************************************************
1321 * GetDlgCtrlID32 (USER32.234)
1323 INT WINAPI GetDlgCtrlID( HWND hwnd )
1325 INT retvalue;
1326 WND *wndPtr = WIN_FindWndPtr(hwnd);
1327 if (!wndPtr) return 0;
1328 retvalue = wndPtr->wIDmenu;
1329 WIN_ReleaseWndPtr(wndPtr);
1330 return retvalue;
1334 /***********************************************************************
1335 * GetDlgItem16 (USER.91)
1337 HWND16 WINAPI GetDlgItem16( HWND16 hwndDlg, INT16 id )
1339 WND *pWnd;
1341 if (!(pWnd = WIN_FindWndPtr( hwndDlg ))) return 0;
1342 for (WIN_UpdateWndPtr(&pWnd,pWnd->child); pWnd; WIN_UpdateWndPtr(&pWnd,pWnd->next))
1343 if (pWnd->wIDmenu == (UINT16)id)
1345 HWND16 retvalue = pWnd->hwndSelf;
1346 WIN_ReleaseWndPtr(pWnd);
1347 return retvalue;
1349 return 0;
1353 /***********************************************************************
1354 * GetDlgItem32 (USER32.235)
1356 HWND WINAPI GetDlgItem( HWND hwndDlg, INT id )
1358 WND *pWnd;
1360 if (!(pWnd = WIN_FindWndPtr( hwndDlg ))) return 0;
1361 for (WIN_UpdateWndPtr(&pWnd,pWnd->child); pWnd;WIN_UpdateWndPtr(&pWnd,pWnd->next))
1362 if (pWnd->wIDmenu == (UINT16)id)
1364 HWND retvalue = pWnd->hwndSelf;
1365 WIN_ReleaseWndPtr(pWnd);
1366 return retvalue;
1368 return 0;
1372 /*******************************************************************
1373 * SendDlgItemMessage16 (USER.101)
1375 LRESULT WINAPI SendDlgItemMessage16( HWND16 hwnd, INT16 id, UINT16 msg,
1376 WPARAM16 wParam, LPARAM lParam )
1378 HWND16 hwndCtrl = GetDlgItem16( hwnd, id );
1379 if (hwndCtrl) return SendMessage16( hwndCtrl, msg, wParam, lParam );
1380 else return 0;
1384 /*******************************************************************
1385 * SendDlgItemMessage32A (USER32.452)
1387 LRESULT WINAPI SendDlgItemMessageA( HWND hwnd, INT id, UINT msg,
1388 WPARAM wParam, LPARAM lParam )
1390 HWND hwndCtrl = GetDlgItem( hwnd, id );
1391 if (hwndCtrl) return SendMessageA( hwndCtrl, msg, wParam, lParam );
1392 else return 0;
1396 /*******************************************************************
1397 * SendDlgItemMessage32W (USER32.453)
1399 LRESULT WINAPI SendDlgItemMessageW( HWND hwnd, INT id, UINT msg,
1400 WPARAM wParam, LPARAM lParam )
1402 HWND hwndCtrl = GetDlgItem( hwnd, id );
1403 if (hwndCtrl) return SendMessageW( hwndCtrl, msg, wParam, lParam );
1404 else return 0;
1408 /*******************************************************************
1409 * SetDlgItemText16 (USER.92)
1411 void WINAPI SetDlgItemText16( HWND16 hwnd, INT16 id, SEGPTR lpString )
1413 SendDlgItemMessage16( hwnd, id, WM_SETTEXT, 0, (LPARAM)lpString );
1417 /*******************************************************************
1418 * SetDlgItemText32A (USER32.478)
1420 BOOL WINAPI SetDlgItemTextA( HWND hwnd, INT id, LPCSTR lpString )
1422 return SendDlgItemMessageA( hwnd, id, WM_SETTEXT, 0, (LPARAM)lpString );
1426 /*******************************************************************
1427 * SetDlgItemText32W (USER32.479)
1429 BOOL WINAPI SetDlgItemTextW( HWND hwnd, INT id, LPCWSTR lpString )
1431 return SendDlgItemMessageW( hwnd, id, WM_SETTEXT, 0, (LPARAM)lpString );
1435 /***********************************************************************
1436 * GetDlgItemText16 (USER.93)
1438 INT16 WINAPI GetDlgItemText16( HWND16 hwnd, INT16 id, SEGPTR str, UINT16 len )
1440 return (INT16)SendDlgItemMessage16( hwnd, id, WM_GETTEXT,
1441 len, (LPARAM)str );
1445 /***********************************************************************
1446 * GetDlgItemText32A (USER32.237)
1448 INT WINAPI GetDlgItemTextA( HWND hwnd, INT id, LPSTR str, UINT len )
1450 return (INT)SendDlgItemMessageA( hwnd, id, WM_GETTEXT,
1451 len, (LPARAM)str );
1455 /***********************************************************************
1456 * GetDlgItemText32W (USER32.238)
1458 INT WINAPI GetDlgItemTextW( HWND hwnd, INT id, LPWSTR str, UINT len )
1460 return (INT)SendDlgItemMessageW( hwnd, id, WM_GETTEXT,
1461 len, (LPARAM)str );
1465 /*******************************************************************
1466 * SetDlgItemInt16 (USER.94)
1468 void WINAPI SetDlgItemInt16( HWND16 hwnd, INT16 id, UINT16 value, BOOL16 fSigned )
1470 SetDlgItemInt( hwnd, (UINT)(UINT16)id, value, fSigned );
1474 /*******************************************************************
1475 * SetDlgItemInt32 (USER32.477)
1477 BOOL WINAPI SetDlgItemInt( HWND hwnd, INT id, UINT value,
1478 BOOL fSigned )
1480 char str[20];
1482 if (fSigned) sprintf( str, "%d", (INT)value );
1483 else sprintf( str, "%u", value );
1484 SendDlgItemMessageA( hwnd, id, WM_SETTEXT, 0, (LPARAM)str );
1485 return TRUE;
1489 /***********************************************************************
1490 * GetDlgItemInt16 (USER.95)
1492 UINT16 WINAPI GetDlgItemInt16( HWND16 hwnd, INT16 id, BOOL16 *translated,
1493 BOOL16 fSigned )
1495 UINT result;
1496 BOOL ok;
1498 if (translated) *translated = FALSE;
1499 result = GetDlgItemInt( hwnd, (UINT)(UINT16)id, &ok, fSigned );
1500 if (!ok) return 0;
1501 if (fSigned)
1503 if (((INT)result < -32767) || ((INT)result > 32767)) return 0;
1505 else
1507 if (result > 65535) return 0;
1509 if (translated) *translated = TRUE;
1510 return (UINT16)result;
1514 /***********************************************************************
1515 * GetDlgItemInt32 (USER32.236)
1517 UINT WINAPI GetDlgItemInt( HWND hwnd, INT id, BOOL *translated,
1518 BOOL fSigned )
1520 char str[30];
1521 char * endptr;
1522 long result = 0;
1524 if (translated) *translated = FALSE;
1525 if (!SendDlgItemMessageA(hwnd, id, WM_GETTEXT, sizeof(str), (LPARAM)str))
1526 return 0;
1527 if (fSigned)
1529 result = strtol( str, &endptr, 10 );
1530 if (!endptr || (endptr == str)) /* Conversion was unsuccessful */
1531 return 0;
1532 if (((result == LONG_MIN) || (result == LONG_MAX)) && (errno==ERANGE))
1533 return 0;
1535 else
1537 result = strtoul( str, &endptr, 10 );
1538 if (!endptr || (endptr == str)) /* Conversion was unsuccessful */
1539 return 0;
1540 if ((result == ULONG_MAX) && (errno == ERANGE)) return 0;
1542 if (translated) *translated = TRUE;
1543 return (UINT)result;
1547 /***********************************************************************
1548 * CheckDlgButton16 (USER.97)
1550 BOOL16 WINAPI CheckDlgButton16( HWND16 hwnd, INT16 id, UINT16 check )
1552 SendDlgItemMessageA( hwnd, id, BM_SETCHECK, check, 0 );
1553 return TRUE;
1557 /***********************************************************************
1558 * CheckDlgButton32 (USER32.45)
1560 BOOL WINAPI CheckDlgButton( HWND hwnd, INT id, UINT check )
1562 SendDlgItemMessageA( hwnd, id, BM_SETCHECK, check, 0 );
1563 return TRUE;
1567 /***********************************************************************
1568 * IsDlgButtonChecked16 (USER.98)
1570 UINT16 WINAPI IsDlgButtonChecked16( HWND16 hwnd, UINT16 id )
1572 return (UINT16)SendDlgItemMessageA( hwnd, id, BM_GETCHECK, 0, 0 );
1576 /***********************************************************************
1577 * IsDlgButtonChecked32 (USER32.344)
1579 UINT WINAPI IsDlgButtonChecked( HWND hwnd, UINT id )
1581 return (UINT)SendDlgItemMessageA( hwnd, id, BM_GETCHECK, 0, 0 );
1585 /***********************************************************************
1586 * CheckRadioButton16 (USER.96)
1588 BOOL16 WINAPI CheckRadioButton16( HWND16 hwndDlg, UINT16 firstID,
1589 UINT16 lastID, UINT16 checkID )
1591 return CheckRadioButton( hwndDlg, firstID, lastID, checkID );
1595 /***********************************************************************
1596 * CheckRadioButton32 (USER32.48)
1598 BOOL WINAPI CheckRadioButton( HWND hwndDlg, UINT firstID,
1599 UINT lastID, UINT checkID )
1601 WND *pWnd = WIN_FindWndPtr( hwndDlg );
1603 if (!pWnd) return FALSE;
1605 for (WIN_UpdateWndPtr(&pWnd,pWnd->child); pWnd;WIN_UpdateWndPtr(&pWnd,pWnd->next))
1606 if ((pWnd->wIDmenu == firstID) || (pWnd->wIDmenu == lastID))
1608 break;
1611 if (!pWnd) return FALSE;
1613 if (pWnd->wIDmenu == lastID)
1614 lastID = firstID; /* Buttons are in reverse order */
1615 while (pWnd)
1617 SendMessageA( pWnd->hwndSelf, BM_SETCHECK,
1618 (pWnd->wIDmenu == checkID), 0 );
1619 if (pWnd->wIDmenu == lastID)
1621 WIN_ReleaseWndPtr(pWnd);
1622 break;
1624 WIN_UpdateWndPtr(&pWnd,pWnd->next);
1626 return TRUE;
1630 /***********************************************************************
1631 * GetDialogBaseUnits (USER.243) (USER32.233)
1633 DWORD WINAPI GetDialogBaseUnits(void)
1635 return MAKELONG( xBaseUnit, yBaseUnit );
1639 /***********************************************************************
1640 * MapDialogRect16 (USER.103)
1642 void WINAPI MapDialogRect16( HWND16 hwnd, LPRECT16 rect )
1644 DIALOGINFO * dlgInfo;
1645 WND * wndPtr = WIN_FindWndPtr( hwnd );
1646 if (!wndPtr) return;
1647 dlgInfo = (DIALOGINFO *)wndPtr->wExtra;
1648 rect->left = (rect->left * dlgInfo->xBaseUnit) / 4;
1649 rect->right = (rect->right * dlgInfo->xBaseUnit) / 4;
1650 rect->top = (rect->top * dlgInfo->yBaseUnit) / 8;
1651 rect->bottom = (rect->bottom * dlgInfo->yBaseUnit) / 8;
1652 WIN_ReleaseWndPtr(wndPtr);
1656 /***********************************************************************
1657 * MapDialogRect32 (USER32.382)
1659 BOOL WINAPI MapDialogRect( HWND hwnd, LPRECT rect )
1661 DIALOGINFO * dlgInfo;
1662 WND * wndPtr = WIN_FindWndPtr( hwnd );
1663 if (!wndPtr) return FALSE;
1664 dlgInfo = (DIALOGINFO *)wndPtr->wExtra;
1665 rect->left = (rect->left * dlgInfo->xBaseUnit) / 4;
1666 rect->right = (rect->right * dlgInfo->xBaseUnit) / 4;
1667 rect->top = (rect->top * dlgInfo->yBaseUnit) / 8;
1668 rect->bottom = (rect->bottom * dlgInfo->yBaseUnit) / 8;
1669 WIN_ReleaseWndPtr(wndPtr);
1670 return TRUE;
1674 /***********************************************************************
1675 * GetNextDlgGroupItem16 (USER.227)
1677 HWND16 WINAPI GetNextDlgGroupItem16( HWND16 hwndDlg, HWND16 hwndCtrl,
1678 BOOL16 fPrevious )
1680 return (HWND16)GetNextDlgGroupItem( hwndDlg, hwndCtrl, fPrevious );
1684 /***********************************************************************
1685 * GetNextDlgGroupItem32 (USER32.275)
1687 HWND WINAPI GetNextDlgGroupItem( HWND hwndDlg, HWND hwndCtrl,
1688 BOOL fPrevious )
1690 WND *pWnd = NULL,
1691 *pWndLast = NULL,
1692 *pWndCtrl = NULL,
1693 *pWndDlg = NULL;
1694 HWND retvalue;
1696 if (!(pWndDlg = WIN_FindWndPtr( hwndDlg ))) return 0;
1697 if (hwndCtrl)
1699 if (!(pWndCtrl = WIN_FindWndPtr( hwndCtrl )))
1701 retvalue = 0;
1702 goto END;
1704 /* Make sure hwndCtrl is a top-level child */
1705 while ((pWndCtrl->dwStyle & WS_CHILD) && (pWndCtrl->parent != pWndDlg))
1706 WIN_UpdateWndPtr(&pWndCtrl,pWndCtrl->parent);
1707 if (pWndCtrl->parent != pWndDlg)
1709 retvalue = 0;
1710 goto END;
1713 else
1715 /* No ctrl specified -> start from the beginning */
1716 if (!(pWndCtrl = WIN_LockWndPtr(pWndDlg->child)))
1718 retvalue = 0;
1719 goto END;
1721 if (fPrevious)
1722 while (pWndCtrl->next) WIN_UpdateWndPtr(&pWndCtrl,pWndCtrl->next);
1725 pWndLast = WIN_LockWndPtr(pWndCtrl);
1726 pWnd = WIN_LockWndPtr(pWndCtrl->next);
1728 while (1)
1730 if (!pWnd || (pWnd->dwStyle & WS_GROUP))
1732 /* Wrap-around to the beginning of the group */
1733 WND *pWndTemp;
1735 WIN_UpdateWndPtr( &pWnd, pWndDlg->child );
1736 for ( pWndTemp = WIN_LockWndPtr( pWnd );
1737 pWndTemp;
1738 WIN_UpdateWndPtr( &pWndTemp, pWndTemp->next) )
1740 if (pWndTemp->dwStyle & WS_GROUP) WIN_UpdateWndPtr( &pWnd, pWndTemp );
1741 if (pWndTemp == pWndCtrl) break;
1743 WIN_ReleaseWndPtr( pWndTemp );
1745 if (pWnd == pWndCtrl) break;
1746 if ((pWnd->dwStyle & WS_VISIBLE) && !(pWnd->dwStyle & WS_DISABLED))
1748 WIN_UpdateWndPtr(&pWndLast,pWnd);
1749 if (!fPrevious) break;
1751 WIN_UpdateWndPtr(&pWnd,pWnd->next);
1753 retvalue = pWndLast->hwndSelf;
1755 WIN_ReleaseWndPtr(pWndLast);
1756 WIN_ReleaseWndPtr(pWnd);
1757 END:
1758 WIN_ReleaseWndPtr(pWndCtrl);
1759 WIN_ReleaseWndPtr(pWndDlg);
1761 return retvalue;
1765 /***********************************************************************
1766 * GetNextDlgTabItem16 (USER.228)
1768 HWND16 WINAPI GetNextDlgTabItem16( HWND16 hwndDlg, HWND16 hwndCtrl,
1769 BOOL16 fPrevious )
1771 return (HWND16)GetNextDlgTabItem( hwndDlg, hwndCtrl, fPrevious );
1775 /***********************************************************************
1776 * GetNextDlgTabItem32 (USER32.276)
1778 HWND WINAPI GetNextDlgTabItem( HWND hwndDlg, HWND hwndCtrl,
1779 BOOL fPrevious )
1781 WND *pWnd = NULL,
1782 *pWndLast = NULL,
1783 *pWndCtrl = NULL,
1784 *pWndDlg = NULL;
1785 HWND retvalue;
1787 if (!(pWndDlg = WIN_FindWndPtr( hwndDlg ))) return 0;
1788 if (hwndCtrl)
1790 if (!(pWndCtrl = WIN_FindWndPtr( hwndCtrl )))
1792 retvalue = 0;
1793 goto END;
1795 /* Make sure hwndCtrl is a top-level child */
1796 while ((pWndCtrl->dwStyle & WS_CHILD) && (pWndCtrl->parent != pWndDlg))
1797 WIN_UpdateWndPtr(&pWndCtrl,pWndCtrl->parent);
1798 if (pWndCtrl->parent != pWndDlg)
1800 retvalue = 0;
1801 goto END;
1804 else
1806 /* No ctrl specified -> start from the beginning */
1807 if (!(pWndCtrl = WIN_LockWndPtr(pWndDlg->child)))
1809 retvalue = 0;
1810 goto END;
1813 if (!fPrevious)
1814 while (pWndCtrl->next) WIN_UpdateWndPtr(&pWndCtrl,pWndCtrl->next);
1817 pWndLast = WIN_LockWndPtr(pWndCtrl);
1818 pWnd = WIN_LockWndPtr(pWndCtrl->next);
1819 while (1)
1821 if (!pWnd) pWnd = WIN_LockWndPtr(pWndDlg->child);
1822 if (pWnd == pWndCtrl) break;
1823 if ((pWnd->dwStyle & WS_TABSTOP) && (pWnd->dwStyle & WS_VISIBLE) &&
1824 !(pWnd->dwStyle & WS_DISABLED))
1826 WIN_UpdateWndPtr(&pWndLast,pWnd);
1827 if (!fPrevious) break;
1829 WIN_UpdateWndPtr(&pWnd,pWnd->next);
1831 retvalue = pWndLast->hwndSelf;
1833 WIN_ReleaseWndPtr(pWndLast);
1834 WIN_ReleaseWndPtr(pWnd);
1835 END:
1836 WIN_ReleaseWndPtr(pWndCtrl);
1837 WIN_ReleaseWndPtr(pWndDlg);
1839 return retvalue;
1844 /**********************************************************************
1845 * DIALOG_DlgDirSelect
1847 * Helper function for DlgDirSelect*
1849 static BOOL DIALOG_DlgDirSelect( HWND hwnd, LPSTR str, INT len,
1850 INT id, BOOL win32, BOOL unicode,
1851 BOOL combo )
1853 char *buffer, *ptr;
1854 INT item, size;
1855 BOOL ret;
1856 HWND listbox = GetDlgItem( hwnd, id );
1858 TRACE(dialog, "%04x '%s' %d\n", hwnd, str, id );
1859 if (!listbox) return FALSE;
1860 if (win32)
1862 item = SendMessageA(listbox, combo ? CB_GETCURSEL
1863 : LB_GETCURSEL, 0, 0 );
1864 if (item == LB_ERR) return FALSE;
1865 size = SendMessageA(listbox, combo ? CB_GETLBTEXTLEN
1866 : LB_GETTEXTLEN, 0, 0 );
1867 if (size == LB_ERR) return FALSE;
1869 else
1871 item = SendMessageA(listbox, combo ? CB_GETCURSEL16
1872 : LB_GETCURSEL16, 0, 0 );
1873 if (item == LB_ERR) return FALSE;
1874 size = SendMessageA(listbox, combo ? CB_GETLBTEXTLEN16
1875 : LB_GETTEXTLEN16, 0, 0 );
1876 if (size == LB_ERR) return FALSE;
1879 if (!(buffer = SEGPTR_ALLOC( size+1 ))) return FALSE;
1881 if (win32)
1882 SendMessageA( listbox, combo ? CB_GETLBTEXT : LB_GETTEXT,
1883 item, (LPARAM)buffer );
1884 else
1885 SendMessage16( listbox, combo ? CB_GETLBTEXT16 : LB_GETTEXT16,
1886 item, (LPARAM)SEGPTR_GET(buffer) );
1888 if ((ret = (buffer[0] == '['))) /* drive or directory */
1890 if (buffer[1] == '-') /* drive */
1892 buffer[3] = ':';
1893 buffer[4] = 0;
1894 ptr = buffer + 2;
1896 else
1898 buffer[strlen(buffer)-1] = '\\';
1899 ptr = buffer + 1;
1902 else ptr = buffer;
1904 if (unicode) lstrcpynAtoW( (LPWSTR)str, ptr, len );
1905 else lstrcpynA( str, ptr, len );
1906 SEGPTR_FREE( buffer );
1907 TRACE(dialog, "Returning %d '%s'\n", ret, str );
1908 return ret;
1912 /**********************************************************************
1913 * DIALOG_DlgDirList
1915 * Helper function for DlgDirList*
1917 static INT DIALOG_DlgDirList( HWND hDlg, LPSTR spec, INT idLBox,
1918 INT idStatic, UINT attrib, BOOL combo )
1920 int drive;
1921 HWND hwnd;
1922 LPSTR orig_spec = spec;
1924 #define SENDMSG(msg,wparam,lparam) \
1925 ((attrib & DDL_POSTMSGS) ? PostMessageA( hwnd, msg, wparam, lparam ) \
1926 : SendMessageA( hwnd, msg, wparam, lparam ))
1928 TRACE(dialog, "%04x '%s' %d %d %04x\n",
1929 hDlg, spec ? spec : "NULL", idLBox, idStatic, attrib );
1931 if (spec && spec[0] && (spec[1] == ':'))
1933 drive = toupper( spec[0] ) - 'A';
1934 spec += 2;
1935 if (!DRIVE_SetCurrentDrive( drive )) return FALSE;
1937 else drive = DRIVE_GetCurrentDrive();
1939 /* If the path exists and is a directory, chdir to it */
1940 if (!spec || !spec[0] || DRIVE_Chdir( drive, spec )) spec = "*.*";
1941 else
1943 char *p, *p2;
1944 p = spec;
1945 if ((p2 = strrchr( p, '\\' ))) p = p2;
1946 if ((p2 = strrchr( p, '/' ))) p = p2;
1947 if (p != spec)
1949 char sep = *p;
1950 *p = 0;
1951 if (!DRIVE_Chdir( drive, spec ))
1953 *p = sep; /* Restore the original spec */
1954 return FALSE;
1956 spec = p + 1;
1960 TRACE(dialog, "path=%c:\\%s mask=%s\n",
1961 'A' + drive, DRIVE_GetDosCwd(drive), spec );
1963 if (idLBox && ((hwnd = GetDlgItem( hDlg, idLBox )) != 0))
1965 SENDMSG( combo ? CB_RESETCONTENT : LB_RESETCONTENT, 0, 0 );
1966 if (attrib & DDL_DIRECTORY)
1968 if (!(attrib & DDL_EXCLUSIVE))
1970 if (SENDMSG( combo ? CB_DIR : LB_DIR,
1971 attrib & ~(DDL_DIRECTORY | DDL_DRIVES),
1972 (LPARAM)spec ) == LB_ERR)
1973 return FALSE;
1975 if (SENDMSG( combo ? CB_DIR : LB_DIR,
1976 (attrib & (DDL_DIRECTORY | DDL_DRIVES)) | DDL_EXCLUSIVE,
1977 (LPARAM)"*.*" ) == LB_ERR)
1978 return FALSE;
1980 else
1982 if (SENDMSG( combo ? CB_DIR : LB_DIR, attrib,
1983 (LPARAM)spec ) == LB_ERR)
1984 return FALSE;
1988 if (idStatic && ((hwnd = GetDlgItem( hDlg, idStatic )) != 0))
1990 char temp[512];
1991 int drive = DRIVE_GetCurrentDrive();
1992 strcpy( temp, "A:\\" );
1993 temp[0] += drive;
1994 lstrcpynA( temp + 3, DRIVE_GetDosCwd(drive), sizeof(temp)-3 );
1995 CharLowerA( temp );
1996 /* Can't use PostMessage() here, because the string is on the stack */
1997 SetDlgItemTextA( hDlg, idStatic, temp );
2000 if (orig_spec && (spec != orig_spec))
2002 /* Update the original file spec */
2003 char *p = spec;
2004 while ((*orig_spec++ = *p++));
2007 return TRUE;
2008 #undef SENDMSG
2012 /**********************************************************************
2013 * DIALOG_DlgDirListW
2015 * Helper function for DlgDirList*32W
2017 static INT DIALOG_DlgDirListW( HWND hDlg, LPWSTR spec, INT idLBox,
2018 INT idStatic, UINT attrib, BOOL combo )
2020 if (spec)
2022 LPSTR specA = HEAP_strdupWtoA( GetProcessHeap(), 0, spec );
2023 INT ret = DIALOG_DlgDirList( hDlg, specA, idLBox, idStatic,
2024 attrib, combo );
2025 lstrcpyAtoW( spec, specA );
2026 HeapFree( GetProcessHeap(), 0, specA );
2027 return ret;
2029 return DIALOG_DlgDirList( hDlg, NULL, idLBox, idStatic, attrib, combo );
2033 /**********************************************************************
2034 * DlgDirSelect (USER.99)
2036 BOOL16 WINAPI DlgDirSelect16( HWND16 hwnd, LPSTR str, INT16 id )
2038 return DlgDirSelectEx16( hwnd, str, 128, id );
2042 /**********************************************************************
2043 * DlgDirSelectComboBox (USER.194)
2045 BOOL16 WINAPI DlgDirSelectComboBox16( HWND16 hwnd, LPSTR str, INT16 id )
2047 return DlgDirSelectComboBoxEx16( hwnd, str, 128, id );
2051 /**********************************************************************
2052 * DlgDirSelectEx16 (USER.422)
2054 BOOL16 WINAPI DlgDirSelectEx16( HWND16 hwnd, LPSTR str, INT16 len, INT16 id )
2056 return DIALOG_DlgDirSelect( hwnd, str, len, id, FALSE, FALSE, FALSE );
2060 /**********************************************************************
2061 * DlgDirSelectEx32A (USER32.149)
2063 BOOL WINAPI DlgDirSelectExA( HWND hwnd, LPSTR str, INT len, INT id )
2065 return DIALOG_DlgDirSelect( hwnd, str, len, id, TRUE, FALSE, FALSE );
2069 /**********************************************************************
2070 * DlgDirSelectEx32W (USER32.150)
2072 BOOL WINAPI DlgDirSelectExW( HWND hwnd, LPWSTR str, INT len, INT id )
2074 return DIALOG_DlgDirSelect( hwnd, (LPSTR)str, len, id, TRUE, TRUE, FALSE );
2078 /**********************************************************************
2079 * DlgDirSelectComboBoxEx16 (USER.423)
2081 BOOL16 WINAPI DlgDirSelectComboBoxEx16( HWND16 hwnd, LPSTR str, INT16 len,
2082 INT16 id )
2084 return DIALOG_DlgDirSelect( hwnd, str, len, id, FALSE, FALSE, TRUE );
2088 /**********************************************************************
2089 * DlgDirSelectComboBoxEx32A (USER32.147)
2091 BOOL WINAPI DlgDirSelectComboBoxExA( HWND hwnd, LPSTR str, INT len,
2092 INT id )
2094 return DIALOG_DlgDirSelect( hwnd, str, len, id, TRUE, FALSE, TRUE );
2098 /**********************************************************************
2099 * DlgDirSelectComboBoxEx32W (USER32.148)
2101 BOOL WINAPI DlgDirSelectComboBoxExW( HWND hwnd, LPWSTR str, INT len,
2102 INT id)
2104 return DIALOG_DlgDirSelect( hwnd, (LPSTR)str, len, id, TRUE, TRUE, TRUE );
2108 /**********************************************************************
2109 * DlgDirList16 (USER.100)
2111 INT16 WINAPI DlgDirList16( HWND16 hDlg, LPSTR spec, INT16 idLBox,
2112 INT16 idStatic, UINT16 attrib )
2114 return DIALOG_DlgDirList( hDlg, spec, idLBox, idStatic, attrib, FALSE );
2118 /**********************************************************************
2119 * DlgDirList32A (USER32.143)
2121 INT WINAPI DlgDirListA( HWND hDlg, LPSTR spec, INT idLBox,
2122 INT idStatic, UINT attrib )
2124 return DIALOG_DlgDirList( hDlg, spec, idLBox, idStatic, attrib, FALSE );
2128 /**********************************************************************
2129 * DlgDirList32W (USER32.146)
2131 INT WINAPI DlgDirListW( HWND hDlg, LPWSTR spec, INT idLBox,
2132 INT idStatic, UINT attrib )
2134 return DIALOG_DlgDirListW( hDlg, spec, idLBox, idStatic, attrib, FALSE );
2138 /**********************************************************************
2139 * DlgDirListComboBox16 (USER.195)
2141 INT16 WINAPI DlgDirListComboBox16( HWND16 hDlg, LPSTR spec, INT16 idCBox,
2142 INT16 idStatic, UINT16 attrib )
2144 return DIALOG_DlgDirList( hDlg, spec, idCBox, idStatic, attrib, TRUE );
2148 /**********************************************************************
2149 * DlgDirListComboBox32A (USER32.144)
2151 INT WINAPI DlgDirListComboBoxA( HWND hDlg, LPSTR spec, INT idCBox,
2152 INT idStatic, UINT attrib )
2154 return DIALOG_DlgDirList( hDlg, spec, idCBox, idStatic, attrib, TRUE );
2158 /**********************************************************************
2159 * DlgDirListComboBox32W (USER32.145)
2161 INT WINAPI DlgDirListComboBoxW( HWND hDlg, LPWSTR spec, INT idCBox,
2162 INT idStatic, UINT attrib )
2164 return DIALOG_DlgDirListW( hDlg, spec, idCBox, idStatic, attrib, TRUE );