4 * Copyright 1993, 1994, 1996 Alexandre Julliard
17 #include "wine/winuser16.h"
18 #include "wine/winbase16.h"
28 #include "debugtools.h"
30 DEFAULT_DEBUG_CHANNEL(dialog
);
33 /* Dialog control information */
70 /* Radio button group */
78 /* Dialog base units */
79 static WORD xBaseUnit
= 0, yBaseUnit
= 0;
81 /***********************************************************************
82 * DIALOG_GetCharSizeFromDC
85 * Calculates the *true* average size of English characters in the
86 * specified font as oppposed to the one returned by GetTextMetrics.
88 * Latest: the X font driver will now compute a proper average width
89 * so this code can be removed
91 static BOOL
DIALOG_GetCharSizeFromDC( HDC hDC
, HFONT hFont
, SIZE
* pSize
)
95 pSize
->cx
= xBaseUnit
;
96 pSize
->cy
= yBaseUnit
;
101 memset(&tm
,0,sizeof(tm
));
102 if (hFont
) hFontPrev
= SelectFont(hDC
,hFont
);
103 if (GetTextMetricsA(hDC
,&tm
))
105 pSize
->cx
= tm
.tmAveCharWidth
;
106 pSize
->cy
= tm
.tmHeight
;
108 /* if variable width font */
109 if (tm
.tmPitchAndFamily
& TMPF_FIXED_PITCH
)
112 const char* szAvgChars
= "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
114 /* Calculate a true average as opposed to the one returned
115 * by tmAveCharWidth. This works better when dealing with
116 * proportional spaced fonts and (more important) that's
117 * how Microsoft's dialog creation code calculates the size
120 if (GetTextExtentPointA(hDC
,szAvgChars
,sizeof(szAvgChars
),&total
))
123 pSize
->cx
= ((2*total
.cx
/sizeof(szAvgChars
)) + 1)/2;
131 /* Use the text metrics */
132 TRACE("Using tm: %ldx%ld (dlg: %dx%d) (%s)\n", tm
.tmAveCharWidth
, tm
.tmHeight
, pSize
->cx
, pSize
->cy
,
133 tm
.tmPitchAndFamily
& TMPF_FIXED_PITCH
? "variable" : "fixed");
134 pSize
->cx
= tm
.tmAveCharWidth
;
135 pSize
->cy
= tm
.tmHeight
;
137 /* select the original font */
138 if (hFontPrev
) SelectFont(hDC
,hFontPrev
);
143 /***********************************************************************
146 * A convenient variant of DIALOG_GetCharSizeFromDC.
148 static BOOL
DIALOG_GetCharSize( HFONT hFont
, SIZE
* pSize
)
151 BOOL Success
= DIALOG_GetCharSizeFromDC( hDC
, hFont
, pSize
);
156 /***********************************************************************
159 * Initialisation of the dialog manager.
161 BOOL
DIALOG_Init(void)
166 /* Calculate the dialog base units */
168 if (!(hdc
= CreateDC16( "DISPLAY", NULL
, NULL
, NULL
))) return FALSE
;
169 if (!DIALOG_GetCharSizeFromDC( hdc
, 0, &size
)) return FALSE
;
174 TRACE("base units = %d,%d\n", xBaseUnit
, yBaseUnit
);
179 /***********************************************************************
180 * DIALOG_GetControl16
182 * Return the class and text of the control pointed to by ptr,
183 * fill the header structure and return a pointer to the next control.
185 static LPCSTR
DIALOG_GetControl16( LPCSTR p
, DLG_CONTROL_INFO
*info
)
187 static char buffer
[10];
190 info
->x
= GET_WORD(p
); p
+= sizeof(WORD
);
191 info
->y
= GET_WORD(p
); p
+= sizeof(WORD
);
192 info
->cx
= GET_WORD(p
); p
+= sizeof(WORD
);
193 info
->cy
= GET_WORD(p
); p
+= sizeof(WORD
);
194 info
->id
= GET_WORD(p
); p
+= sizeof(WORD
);
195 info
->style
= GET_DWORD(p
); p
+= sizeof(DWORD
);
202 case 0x80: strcpy( buffer
, "BUTTON" ); break;
203 case 0x81: strcpy( buffer
, "EDIT" ); break;
204 case 0x82: strcpy( buffer
, "STATIC" ); break;
205 case 0x83: strcpy( buffer
, "LISTBOX" ); break;
206 case 0x84: strcpy( buffer
, "SCROLLBAR" ); break;
207 case 0x85: strcpy( buffer
, "COMBOBOX" ); break;
208 default: buffer
[0] = '\0'; break;
210 info
->className
= buffer
;
219 int_id
= ((BYTE
)*p
== 0xff);
222 /* Integer id, not documented (?). Only works for SS_ICON controls */
223 info
->windowName
= (LPCSTR
)(UINT
)GET_WORD(p
+1);
228 info
->windowName
= p
;
234 /* Additional CTLDATA available for this control. */
235 info
->data
= SEGPTR_ALLOC(*p
);
236 memcpy( info
->data
, p
+ 1, *p
);
238 else info
->data
= NULL
;
243 TRACE(" %s %04x %d, %d, %d, %d, %d, %08lx, %08lx\n",
244 info
->className
, LOWORD(info
->windowName
),
245 info
->id
, info
->x
, info
->y
, info
->cx
, info
->cy
,
246 info
->style
, (DWORD
)SEGPTR_GET(info
->data
) );
248 TRACE(" %s '%s' %d, %d, %d, %d, %d, %08lx, %08lx\n",
249 info
->className
, info
->windowName
,
250 info
->id
, info
->x
, info
->y
, info
->cx
, info
->cy
,
251 info
->style
, (DWORD
)SEGPTR_GET(info
->data
) );
257 /***********************************************************************
258 * DIALOG_GetControl32
260 * Return the class and text of the control pointed to by ptr,
261 * fill the header structure and return a pointer to the next control.
263 static const WORD
*DIALOG_GetControl32( const WORD
*p
, DLG_CONTROL_INFO
*info
,
268 info
->helpId
= GET_DWORD(p
); p
+= 2;
269 info
->exStyle
= GET_DWORD(p
); p
+= 2;
270 info
->style
= GET_DWORD(p
); p
+= 2;
275 info
->style
= GET_DWORD(p
); p
+= 2;
276 info
->exStyle
= GET_DWORD(p
); p
+= 2;
278 info
->x
= GET_WORD(p
); p
++;
279 info
->y
= GET_WORD(p
); p
++;
280 info
->cx
= GET_WORD(p
); p
++;
281 info
->cy
= GET_WORD(p
); p
++;
285 /* id is a DWORD for DIALOGEX */
286 info
->id
= GET_DWORD(p
);
291 info
->id
= GET_WORD(p
);
295 if (GET_WORD(p
) == 0xffff)
297 static const WCHAR class_names
[6][10] =
299 { 'B','u','t','t','o','n', }, /* 0x80 */
300 { 'E','d','i','t', }, /* 0x81 */
301 { 'S','t','a','t','i','c', }, /* 0x82 */
302 { 'L','i','s','t','B','o','x', }, /* 0x83 */
303 { 'S','c','r','o','l','l','B','a','r', }, /* 0x84 */
304 { 'C','o','m','b','o','B','o','x', } /* 0x85 */
306 WORD id
= GET_WORD(p
+1);
307 if ((id
>= 0x80) && (id
<= 0x85))
308 info
->className
= (LPCSTR
)class_names
[id
- 0x80];
311 info
->className
= NULL
;
312 ERR("Unknown built-in class id %04x\n", id
);
318 info
->className
= (LPCSTR
)p
;
319 p
+= lstrlenW( (LPCWSTR
)p
) + 1;
322 if (GET_WORD(p
) == 0xffff) /* Is it an integer id? */
324 info
->windowName
= (LPCSTR
)(UINT
)GET_WORD(p
+ 1);
329 info
->windowName
= (LPCSTR
)p
;
330 p
+= lstrlenW( (LPCWSTR
)p
) + 1;
333 TRACE(" %s %s %d, %d, %d, %d, %d, %08lx, %08lx, %08lx\n",
334 debugstr_w( (LPCWSTR
)info
->className
),
335 debugres_w( (LPCWSTR
)info
->windowName
),
336 info
->id
, info
->x
, info
->y
, info
->cx
, info
->cy
,
337 info
->style
, info
->exStyle
, info
->helpId
);
341 if (TRACE_ON(dialog
))
343 WORD i
, count
= GET_WORD(p
) / sizeof(WORD
);
346 for (i
= 0; i
< count
; i
++) DPRINTF( "%04x,", GET_WORD(p
+i
+1) );
350 info
->data
= (LPVOID
)(p
+ 1);
351 p
+= GET_WORD(p
) / sizeof(WORD
);
353 else info
->data
= NULL
;
356 /* Next control is on dword boundary */
357 return (const WORD
*)((((int)p
) + 3) & ~3);
361 /***********************************************************************
362 * DIALOG_CreateControls
364 * Create the control windows for a dialog.
366 static BOOL
DIALOG_CreateControls( WND
*pWnd
, LPCSTR
template,
367 const DLG_TEMPLATE
*dlgTemplate
,
368 HINSTANCE hInst
, BOOL win32
)
370 DIALOGINFO
*dlgInfo
= (DIALOGINFO
*)pWnd
->wExtra
;
371 DLG_CONTROL_INFO info
;
372 HWND hwndCtrl
, hwndDefButton
= 0;
373 INT items
= dlgTemplate
->nbItems
;
380 HINSTANCE16 instance
;
381 template = DIALOG_GetControl16( template, &info
);
382 if (HIWORD(info
.className
) && !strcmp( info
.className
, "EDIT") &&
383 ((pWnd
->dwStyle
& DS_LOCALEDIT
) != DS_LOCALEDIT
))
385 if (!dlgInfo
->hDialogHeap
)
387 dlgInfo
->hDialogHeap
= GlobalAlloc16(GMEM_FIXED
, 0x10000);
388 if (!dlgInfo
->hDialogHeap
)
390 ERR("Insufficient memory to create heap for edit control\n" );
393 LocalInit16(dlgInfo
->hDialogHeap
, 0, 0xffff);
395 instance
= dlgInfo
->hDialogHeap
;
397 else instance
= (HINSTANCE16
)hInst
;
399 hwndCtrl
= CreateWindowEx16( info
.exStyle
| WS_EX_NOPARENTNOTIFY
,
400 info
.className
, info
.windowName
,
401 info
.style
| WS_CHILD
,
402 MulDiv(info
.x
, dlgInfo
->xBaseUnit
, 4),
403 MulDiv(info
.y
, dlgInfo
->yBaseUnit
, 8),
404 MulDiv(info
.cx
, dlgInfo
->xBaseUnit
, 4),
405 MulDiv(info
.cy
, dlgInfo
->yBaseUnit
, 8),
406 pWnd
->hwndSelf
, (HMENU16
)info
.id
,
407 instance
, (LPVOID
)SEGPTR_GET(info
.data
) );
409 if (info
.data
) SEGPTR_FREE(info
.data
);
413 template = (LPCSTR
)DIALOG_GetControl32( (WORD
*)template, &info
,
414 dlgTemplate
->dialogEx
);
415 hwndCtrl
= CreateWindowExW( info
.exStyle
| WS_EX_NOPARENTNOTIFY
,
416 (LPCWSTR
)info
.className
,
417 (LPCWSTR
)info
.windowName
,
418 info
.style
| WS_CHILD
,
419 MulDiv(info
.x
, dlgInfo
->xBaseUnit
, 4),
420 MulDiv(info
.y
, dlgInfo
->yBaseUnit
, 8),
421 MulDiv(info
.cx
, dlgInfo
->xBaseUnit
, 4),
422 MulDiv(info
.cy
, dlgInfo
->yBaseUnit
, 8),
423 pWnd
->hwndSelf
, (HMENU
)info
.id
,
426 if (!hwndCtrl
) return FALSE
;
428 /* Send initialisation messages to the control */
429 if (dlgInfo
->hUserFont
) SendMessageA( hwndCtrl
, WM_SETFONT
,
430 (WPARAM
)dlgInfo
->hUserFont
, 0 );
431 if (SendMessageA(hwndCtrl
, WM_GETDLGCODE
, 0, 0) & DLGC_DEFPUSHBUTTON
)
433 /* If there's already a default push-button, set it back */
434 /* to normal and use this one instead. */
436 SendMessageA( hwndDefButton
, BM_SETSTYLE
,
437 BS_PUSHBUTTON
,FALSE
);
438 hwndDefButton
= hwndCtrl
;
439 dlgInfo
->idResult
= GetWindowWord( hwndCtrl
, GWW_ID
);
447 /***********************************************************************
448 * DIALOG_ParseTemplate16
450 * Fill a DLG_TEMPLATE structure from the dialog template, and return
451 * a pointer to the first control.
453 static LPCSTR
DIALOG_ParseTemplate16( LPCSTR p
, DLG_TEMPLATE
* result
)
455 result
->style
= GET_DWORD(p
); p
+= sizeof(DWORD
);
457 result
->nbItems
= (unsigned char) *p
++;
458 result
->x
= GET_WORD(p
); p
+= sizeof(WORD
);
459 result
->y
= GET_WORD(p
); p
+= sizeof(WORD
);
460 result
->cx
= GET_WORD(p
); p
+= sizeof(WORD
);
461 result
->cy
= GET_WORD(p
); p
+= sizeof(WORD
);
462 TRACE("DIALOG %d, %d, %d, %d\n",
463 result
->x
, result
->y
, result
->cx
, result
->cy
);
464 TRACE(" STYLE %08lx\n", result
->style
);
466 /* Get the menu name */
471 result
->menuName
= 0;
475 result
->menuName
= (LPCSTR
)(UINT
)GET_WORD( p
+ 1 );
477 TRACE(" MENU %04x\n", LOWORD(result
->menuName
) );
480 result
->menuName
= p
;
481 TRACE(" MENU '%s'\n", p
);
486 /* Get the class name */
490 result
->className
= p
;
491 TRACE(" CLASS '%s'\n", result
->className
);
493 else result
->className
= DIALOG_CLASS_ATOM
;
496 /* Get the window caption */
500 TRACE(" CAPTION '%s'\n", result
->caption
);
502 /* Get the font name */
504 if (result
->style
& DS_SETFONT
)
506 result
->pointSize
= GET_WORD(p
);
508 result
->faceName
= p
;
510 TRACE(" FONT %d,'%s'\n",
511 result
->pointSize
, result
->faceName
);
517 /***********************************************************************
518 * DIALOG_ParseTemplate32
520 * Fill a DLG_TEMPLATE structure from the dialog template, and return
521 * a pointer to the first control.
523 static LPCSTR
DIALOG_ParseTemplate32( LPCSTR
template, DLG_TEMPLATE
* result
)
525 const WORD
*p
= (const WORD
*)template;
527 result
->style
= GET_DWORD(p
); p
+= 2;
528 if (result
->style
== 0xffff0001) /* DIALOGEX resource */
530 result
->dialogEx
= TRUE
;
531 result
->helpId
= GET_DWORD(p
); p
+= 2;
532 result
->exStyle
= GET_DWORD(p
); p
+= 2;
533 result
->style
= GET_DWORD(p
); p
+= 2;
537 result
->dialogEx
= FALSE
;
539 result
->exStyle
= GET_DWORD(p
); p
+= 2;
541 result
->nbItems
= GET_WORD(p
); p
++;
542 result
->x
= GET_WORD(p
); p
++;
543 result
->y
= GET_WORD(p
); p
++;
544 result
->cx
= GET_WORD(p
); p
++;
545 result
->cy
= GET_WORD(p
); p
++;
546 TRACE("DIALOG%s %d, %d, %d, %d, %ld\n",
547 result
->dialogEx
? "EX" : "", result
->x
, result
->y
,
548 result
->cx
, result
->cy
, result
->helpId
);
549 TRACE(" STYLE 0x%08lx\n", result
->style
);
550 TRACE(" EXSTYLE 0x%08lx\n", result
->exStyle
);
552 /* Get the menu name */
557 result
->menuName
= NULL
;
561 result
->menuName
= (LPCSTR
)(UINT
)GET_WORD( p
+ 1 );
563 TRACE(" MENU %04x\n", LOWORD(result
->menuName
) );
566 result
->menuName
= (LPCSTR
)p
;
567 TRACE(" MENU %s\n", debugstr_w( (LPCWSTR
)p
));
568 p
+= lstrlenW( (LPCWSTR
)p
) + 1;
572 /* Get the class name */
577 result
->className
= DIALOG_CLASS_ATOM
;
581 result
->className
= (LPCSTR
)(UINT
)GET_WORD( p
+ 1 );
583 TRACE(" CLASS %04x\n", LOWORD(result
->className
) );
586 result
->className
= (LPCSTR
)p
;
587 TRACE(" CLASS %s\n", debugstr_w( (LPCWSTR
)p
));
588 p
+= lstrlenW( (LPCWSTR
)p
) + 1;
592 /* Get the window caption */
594 result
->caption
= (LPCSTR
)p
;
595 p
+= lstrlenW( (LPCWSTR
)p
) + 1;
596 TRACE(" CAPTION %s\n", debugstr_w( (LPCWSTR
)result
->caption
) );
598 /* Get the font name */
600 if (result
->style
& DS_SETFONT
)
602 result
->pointSize
= GET_WORD(p
);
604 if (result
->dialogEx
)
606 result
->weight
= GET_WORD(p
); p
++;
607 result
->italic
= LOBYTE(GET_WORD(p
)); p
++;
611 result
->weight
= FW_DONTCARE
;
612 result
->italic
= FALSE
;
614 result
->faceName
= (LPCSTR
)p
;
615 p
+= lstrlenW( (LPCWSTR
)p
) + 1;
616 TRACE(" FONT %d, %s, %d, %s\n",
617 result
->pointSize
, debugstr_w( (LPCWSTR
)result
->faceName
),
618 result
->weight
, result
->italic
? "TRUE" : "FALSE" );
621 /* First control is on dword boundary */
622 return (LPCSTR
)((((int)p
) + 3) & ~3);
626 /***********************************************************************
627 * DIALOG_CreateIndirect
629 HWND
DIALOG_CreateIndirect( HINSTANCE hInst
, LPCSTR dlgTemplate
,
630 BOOL win32Template
, HWND owner
,
631 DLGPROC16 dlgProc
, LPARAM param
,
632 WINDOWPROCTYPE procType
)
639 DLG_TEMPLATE
template;
640 DIALOGINFO
* dlgInfo
;
641 WORD xUnit
= xBaseUnit
;
642 WORD yUnit
= yBaseUnit
;
644 /* Parse dialog template */
646 if (!dlgTemplate
) return 0;
648 dlgTemplate
= DIALOG_ParseTemplate32( dlgTemplate
, &template );
650 dlgTemplate
= DIALOG_ParseTemplate16( dlgTemplate
, &template );
654 if (template.menuName
)
658 LPSTR str
= SEGPTR_STRDUP( template.menuName
);
659 hMenu
= LoadMenu16( hInst
, SEGPTR_GET(str
) );
662 else hMenu
= LoadMenuW( hInst
, (LPCWSTR
)template.menuName
);
665 /* Create custom font if needed */
667 if (template.style
& DS_SETFONT
)
669 /* The font height must be negative as it is a point size */
670 /* and must be converted to pixels first */
671 /* (see CreateFont() documentation in the Windows SDK). */
673 int pixels
= template.pointSize
* GetDeviceCaps(dc
, LOGPIXELSY
)/72;
677 hFont
= CreateFontW( -pixels
, 0, 0, 0, template.weight
,
678 template.italic
, FALSE
, FALSE
,
679 DEFAULT_CHARSET
, 0, 0,
680 PROOF_QUALITY
, FF_DONTCARE
,
681 (LPCWSTR
)template.faceName
);
683 hFont
= CreateFont16( -pixels
, 0, 0, 0, FW_DONTCARE
,
685 DEFAULT_CHARSET
, 0, 0,
686 PROOF_QUALITY
, FF_DONTCARE
,
691 if (DIALOG_GetCharSize(hFont
,&charSize
))
697 TRACE("units = %d,%d\n", xUnit
, yUnit
);
700 /* Create dialog main window */
702 rect
.left
= rect
.top
= 0;
703 rect
.right
= MulDiv(template.cx
, xUnit
, 4);
704 rect
.bottom
= MulDiv(template.cy
, yUnit
, 8);
705 if (template.style
& DS_MODALFRAME
)
706 template.exStyle
|= WS_EX_DLGMODALFRAME
;
707 AdjustWindowRectEx( &rect
, template.style
,
708 hMenu
? TRUE
: FALSE
, template.exStyle
);
709 rect
.right
-= rect
.left
;
710 rect
.bottom
-= rect
.top
;
712 if ((INT16
)template.x
== CW_USEDEFAULT16
)
714 rect
.left
= rect
.top
= win32Template
? CW_USEDEFAULT
: CW_USEDEFAULT16
;
718 if (template.style
& DS_CENTER
)
720 rect
.left
= (GetSystemMetrics(SM_CXSCREEN
) - rect
.right
) / 2;
721 rect
.top
= (GetSystemMetrics(SM_CYSCREEN
) - rect
.bottom
) / 2;
725 rect
.left
+= MulDiv(template.x
, xUnit
, 4);
726 rect
.top
+= MulDiv(template.y
, yUnit
, 8);
728 if ( !(template.style
& WS_CHILD
) )
732 if( !(template.style
& DS_ABSALIGN
) )
733 ClientToScreen( owner
, (POINT
*)&rect
);
735 /* try to fit it into the desktop */
737 if( (dX
= rect
.left
+ rect
.right
+ GetSystemMetrics(SM_CXDLGFRAME
)
738 - GetSystemMetrics(SM_CXSCREEN
)) > 0 ) rect
.left
-= dX
;
739 if( (dY
= rect
.top
+ rect
.bottom
+ GetSystemMetrics(SM_CYDLGFRAME
)
740 - GetSystemMetrics(SM_CYSCREEN
)) > 0 ) rect
.top
-= dY
;
741 if( rect
.left
< 0 ) rect
.left
= 0;
742 if( rect
.top
< 0 ) rect
.top
= 0;
747 hwnd
= CreateWindowEx16(template.exStyle
, template.className
,
748 template.caption
, template.style
& ~WS_VISIBLE
,
749 rect
.left
, rect
.top
, rect
.right
, rect
.bottom
,
750 owner
, hMenu
, hInst
, NULL
);
752 hwnd
= CreateWindowExW(template.exStyle
, (LPCWSTR
)template.className
,
753 (LPCWSTR
)template.caption
,
754 template.style
& ~WS_VISIBLE
,
755 rect
.left
, rect
.top
, rect
.right
, rect
.bottom
,
756 owner
, hMenu
, hInst
, NULL
);
760 if (hFont
) DeleteObject( hFont
);
761 if (hMenu
) DestroyMenu( hMenu
);
764 wndPtr
= WIN_FindWndPtr( hwnd
);
765 wndPtr
->flags
|= WIN_ISDIALOG
;
766 wndPtr
->helpContext
= template.helpId
;
768 /* Initialise dialog extra data */
770 dlgInfo
= (DIALOGINFO
*)wndPtr
->wExtra
;
771 WINPROC_SetProc( &dlgInfo
->dlgProc
, (WNDPROC16
)dlgProc
, procType
, WIN_PROC_WINDOW
);
772 dlgInfo
->hUserFont
= hFont
;
773 dlgInfo
->hMenu
= hMenu
;
774 dlgInfo
->xBaseUnit
= xUnit
;
775 dlgInfo
->yBaseUnit
= yUnit
;
776 dlgInfo
->msgResult
= 0;
777 dlgInfo
->idResult
= 0;
779 dlgInfo
->hDialogHeap
= 0;
781 if (dlgInfo
->hUserFont
)
782 SendMessageA( hwnd
, WM_SETFONT
, (WPARAM
)dlgInfo
->hUserFont
, 0 );
784 /* Create controls */
786 if (DIALOG_CreateControls( wndPtr
, dlgTemplate
, &template,
787 hInst
, win32Template
))
789 HWND hwndPreInitFocus
;
791 /* Send initialisation messages and set focus */
793 dlgInfo
->hwndFocus
= GetNextDlgTabItem( hwnd
, 0, FALSE
);
795 hwndPreInitFocus
= GetFocus();
796 if (SendMessageA( hwnd
, WM_INITDIALOG
, (WPARAM
)dlgInfo
->hwndFocus
, param
))
798 /* check where the focus is again, some controls status might have changed in
800 dlgInfo
->hwndFocus
= GetNextDlgTabItem( hwnd
, 0, FALSE
);
801 SetFocus( dlgInfo
->hwndFocus
);
805 /* If the dlgproc has returned FALSE (indicating handling of keyboard focus)
806 but the focus has not changed, set the focus where we expect it. */
807 if ( (wndPtr
->dwStyle
& WS_VISIBLE
) && ( GetFocus() == hwndPreInitFocus
) )
809 dlgInfo
->hwndFocus
= GetNextDlgTabItem( hwnd
, 0, FALSE
);
810 SetFocus( dlgInfo
->hwndFocus
);
814 if (template.style
& WS_VISIBLE
&& !(wndPtr
->dwStyle
& WS_VISIBLE
))
816 ShowWindow( hwnd
, SW_SHOWNORMAL
); /* SW_SHOW doesn't always work */
817 UpdateWindow( hwnd
);
819 WIN_ReleaseWndPtr(wndPtr
);
822 WIN_ReleaseWndPtr(wndPtr
);
823 if( IsWindow(hwnd
) ) DestroyWindow( hwnd
);
828 /***********************************************************************
829 * CreateDialog16 (USER.89)
831 HWND16 WINAPI
CreateDialog16( HINSTANCE16 hInst
, SEGPTR dlgTemplate
,
832 HWND16 owner
, DLGPROC16 dlgProc
)
834 return CreateDialogParam16( hInst
, dlgTemplate
, owner
, dlgProc
, 0 );
838 /***********************************************************************
839 * CreateDialogParam16 (USER.241)
841 HWND16 WINAPI
CreateDialogParam16( HINSTANCE16 hInst
, SEGPTR dlgTemplate
,
842 HWND16 owner
, DLGPROC16 dlgProc
,
850 TRACE("%04x,%08lx,%04x,%08lx,%ld\n",
851 hInst
, (DWORD
)dlgTemplate
, owner
, (DWORD
)dlgProc
, param
);
853 if (!(hRsrc
= FindResource16( hInst
, dlgTemplate
, RT_DIALOG16
))) return 0;
854 if (!(hmem
= LoadResource16( hInst
, hRsrc
))) return 0;
855 if (!(data
= LockResource16( hmem
))) hwnd
= 0;
856 else hwnd
= CreateDialogIndirectParam16( hInst
, data
, owner
,
858 FreeResource16( hmem
);
862 /***********************************************************************
863 * CreateDialogParamA (USER32.73)
865 HWND WINAPI
CreateDialogParamA( HINSTANCE hInst
, LPCSTR name
,
866 HWND owner
, DLGPROC dlgProc
,
869 HANDLE hrsrc
= FindResourceA( hInst
, name
, RT_DIALOGA
);
870 if (!hrsrc
) return 0;
871 return CreateDialogIndirectParamA( hInst
,
872 (LPVOID
)LoadResource(hInst
, hrsrc
),
873 owner
, dlgProc
, param
);
877 /***********************************************************************
878 * CreateDialogParamW (USER32.74)
880 HWND WINAPI
CreateDialogParamW( HINSTANCE hInst
, LPCWSTR name
,
881 HWND owner
, DLGPROC dlgProc
,
884 HANDLE hrsrc
= FindResourceW( hInst
, name
, RT_DIALOGW
);
885 if (!hrsrc
) return 0;
886 return CreateDialogIndirectParamW( hInst
,
887 (LPVOID
)LoadResource(hInst
, hrsrc
),
888 owner
, dlgProc
, param
);
892 /***********************************************************************
893 * CreateDialogIndirect16 (USER.219)
895 HWND16 WINAPI
CreateDialogIndirect16( HINSTANCE16 hInst
, LPCVOID dlgTemplate
,
896 HWND16 owner
, DLGPROC16 dlgProc
)
898 return CreateDialogIndirectParam16( hInst
, dlgTemplate
, owner
, dlgProc
, 0);
902 /***********************************************************************
903 * CreateDialogIndirectParam16 (USER.242)
905 HWND16 WINAPI
CreateDialogIndirectParam16( HINSTANCE16 hInst
,
907 HWND16 owner
, DLGPROC16 dlgProc
,
910 return DIALOG_CreateIndirect( hInst
, dlgTemplate
, FALSE
, owner
,
911 dlgProc
, param
, WIN_PROC_16
);
915 /***********************************************************************
916 * CreateDialogIndirectParamA (USER32.69)
918 HWND WINAPI
CreateDialogIndirectParamA( HINSTANCE hInst
,
920 HWND owner
, DLGPROC dlgProc
,
923 return DIALOG_CreateIndirect( hInst
, dlgTemplate
, TRUE
, owner
,
924 (DLGPROC16
)dlgProc
, param
, WIN_PROC_32A
);
927 /***********************************************************************
928 * CreateDialogIndirectParamAorW (USER32.71)
930 HWND WINAPI
CreateDialogIndirectParamAorW( HINSTANCE hInst
,
932 HWND owner
, DLGPROC dlgProc
,
934 { FIXME("assume WIN_PROC_32W\n");
935 return DIALOG_CreateIndirect( hInst
, dlgTemplate
, TRUE
, owner
,
936 (DLGPROC16
)dlgProc
, param
, WIN_PROC_32W
);
939 /***********************************************************************
940 * CreateDialogIndirectParamW (USER32.72)
942 HWND WINAPI
CreateDialogIndirectParamW( HINSTANCE hInst
,
944 HWND owner
, DLGPROC dlgProc
,
947 return DIALOG_CreateIndirect( hInst
, dlgTemplate
, TRUE
, owner
,
948 (DLGPROC16
)dlgProc
, param
, WIN_PROC_32W
);
952 /***********************************************************************
955 INT
DIALOG_DoDialogBox( HWND hwnd
, HWND owner
)
958 DIALOGINFO
* dlgInfo
;
962 /* Owner must be a top-level window */
963 owner
= WIN_GetTopParent( owner
);
964 if (!(wndPtr
= WIN_FindWndPtr( hwnd
))) return -1;
965 dlgInfo
= (DIALOGINFO
*)wndPtr
->wExtra
;
967 if (!dlgInfo
->flags
& DF_END
) /* was EndDialog called in WM_INITDIALOG ? */
969 EnableWindow( owner
, FALSE
);
970 ShowWindow( hwnd
, SW_SHOW
);
971 while (MSG_InternalGetMessage(QMSG_WIN32A
, &msg
, hwnd
, owner
, MSGF_DIALOGBOX
,
972 PM_REMOVE
, !(wndPtr
->dwStyle
& DS_NOIDLEMSG
), NULL
))
974 if (!IsDialogMessageA( hwnd
, &msg
))
976 TranslateMessage( &msg
);
977 DispatchMessageA( &msg
);
979 if (dlgInfo
->flags
& DF_END
) break;
981 EnableWindow( owner
, TRUE
);
983 retval
= dlgInfo
->idResult
;
984 WIN_ReleaseWndPtr(wndPtr
);
985 DestroyWindow( hwnd
);
990 /***********************************************************************
991 * DialogBox16 (USER.87)
993 INT16 WINAPI
DialogBox16( HINSTANCE16 hInst
, SEGPTR dlgTemplate
,
994 HWND16 owner
, DLGPROC16 dlgProc
)
996 return DialogBoxParam16( hInst
, dlgTemplate
, owner
, dlgProc
, 0 );
1000 /***********************************************************************
1001 * DialogBoxParam16 (USER.239)
1003 INT16 WINAPI
DialogBoxParam16( HINSTANCE16 hInst
, SEGPTR
template,
1004 HWND16 owner
, DLGPROC16 dlgProc
, LPARAM param
)
1006 HWND16 hwnd
= CreateDialogParam16( hInst
, template, owner
, dlgProc
, param
);
1007 if (hwnd
) return (INT16
)DIALOG_DoDialogBox( hwnd
, owner
);
1012 /***********************************************************************
1013 * DialogBoxParamA (USER32.139)
1015 INT WINAPI
DialogBoxParamA( HINSTANCE hInst
, LPCSTR name
,
1016 HWND owner
, DLGPROC dlgProc
, LPARAM param
)
1018 HWND hwnd
= CreateDialogParamA( hInst
, name
, owner
, dlgProc
, param
);
1019 if (hwnd
) return DIALOG_DoDialogBox( hwnd
, owner
);
1024 /***********************************************************************
1025 * DialogBoxParamW (USER32.140)
1027 INT WINAPI
DialogBoxParamW( HINSTANCE hInst
, LPCWSTR name
,
1028 HWND owner
, DLGPROC dlgProc
, LPARAM param
)
1030 HWND hwnd
= CreateDialogParamW( hInst
, name
, owner
, dlgProc
, param
);
1031 if (hwnd
) return DIALOG_DoDialogBox( hwnd
, owner
);
1036 /***********************************************************************
1037 * DialogBoxIndirect16 (USER.218)
1039 INT16 WINAPI
DialogBoxIndirect16( HINSTANCE16 hInst
, HANDLE16 dlgTemplate
,
1040 HWND16 owner
, DLGPROC16 dlgProc
)
1042 return DialogBoxIndirectParam16( hInst
, dlgTemplate
, owner
, dlgProc
, 0 );
1046 /***********************************************************************
1047 * DialogBoxIndirectParam16 (USER.240)
1049 INT16 WINAPI
DialogBoxIndirectParam16( HINSTANCE16 hInst
, HANDLE16 dlgTemplate
,
1050 HWND16 owner
, DLGPROC16 dlgProc
,
1056 if (!(ptr
= GlobalLock16( dlgTemplate
))) return -1;
1057 hwnd
= CreateDialogIndirectParam16( hInst
, ptr
, owner
, dlgProc
, param
);
1058 GlobalUnlock16( dlgTemplate
);
1059 if (hwnd
) return (INT16
)DIALOG_DoDialogBox( hwnd
, owner
);
1064 /***********************************************************************
1065 * DialogBoxIndirectParamA (USER32.136)
1067 INT WINAPI
DialogBoxIndirectParamA(HINSTANCE hInstance
, LPCVOID
template,
1068 HWND owner
, DLGPROC dlgProc
,
1071 HWND hwnd
= CreateDialogIndirectParamA( hInstance
, template,
1072 owner
, dlgProc
, param
);
1073 if (hwnd
) return DIALOG_DoDialogBox( hwnd
, owner
);
1078 /***********************************************************************
1079 * DialogBoxIndirectParamW (USER32.138)
1081 INT WINAPI
DialogBoxIndirectParamW(HINSTANCE hInstance
, LPCVOID
template,
1082 HWND owner
, DLGPROC dlgProc
,
1085 HWND hwnd
= CreateDialogIndirectParamW( hInstance
, template,
1086 owner
, dlgProc
, param
);
1087 if (hwnd
) return DIALOG_DoDialogBox( hwnd
, owner
);
1091 /***********************************************************************
1092 * DialogBoxIndirectParamAorW (USER32.138)
1094 INT WINAPI
DialogBoxIndirectParamAorW(HINSTANCE hInstance
, LPCVOID
template,
1095 HWND owner
, DLGPROC dlgProc
,
1096 LPARAM param
, DWORD x
)
1099 FIXME("0x%08x %p 0x%08x %p 0x%08lx 0x%08lx\n",
1100 hInstance
, template, owner
, dlgProc
, param
, x
);
1101 hwnd
= CreateDialogIndirectParamW( hInstance
, template,
1102 owner
, dlgProc
, param
);
1103 if (hwnd
) return DIALOG_DoDialogBox( hwnd
, owner
);
1107 /***********************************************************************
1108 * EndDialog16 (USER.88)
1110 BOOL16 WINAPI
EndDialog16( HWND16 hwnd
, INT16 retval
)
1112 return EndDialog( hwnd
, retval
);
1116 /***********************************************************************
1117 * EndDialog (USER32.173)
1119 BOOL WINAPI
EndDialog( HWND hwnd
, INT retval
)
1121 WND
* wndPtr
= WIN_FindWndPtr( hwnd
);
1122 DIALOGINFO
* dlgInfo
;
1125 TRACE("%04x %d\n", hwnd
, retval
);
1129 ERR("got invalid window handle (%04x); buggy app !?\n", hwnd
);
1133 if ((dlgInfo
= (DIALOGINFO
*)wndPtr
->wExtra
))
1135 dlgInfo
->idResult
= retval
;
1136 dlgInfo
->flags
|= DF_END
;
1140 hOwner
= WIN_GetTopParent( wndPtr
->owner
->hwndSelf
);
1142 /* Enable the owner first */
1143 if (hOwner
&& !IsWindowEnabled(hOwner
))
1144 EnableWindow( hOwner
, TRUE
);
1146 /* Windows sets the focus to the dialog itself in EndDialog */
1148 if (IsChild(hwnd
, GetFocus()))
1149 SetFocus(wndPtr
->hwndSelf
);
1151 /* Don't have to send a ShowWindow(SW_HIDE), just do
1152 SetWindowPos with SWP_HIDEWINDOW as done in Windows */
1154 SetWindowPos(hwnd
, (HWND
)0, 0, 0, 0, 0, SWP_NOMOVE
| SWP_NOSIZE
1155 | SWP_NOZORDER
| SWP_NOACTIVATE
| SWP_HIDEWINDOW
);
1157 WIN_ReleaseWndPtr(wndPtr
);
1163 /***********************************************************************
1164 * DIALOG_IsAccelerator
1166 static BOOL
DIALOG_IsAccelerator( HWND hwnd
, HWND hwndDlg
, WPARAM vKey
)
1168 HWND hwndControl
= hwnd
;
1171 BOOL RetVal
= FALSE
;
1176 wndPtr
= WIN_FindWndPtr( hwndControl
);
1177 if ( (wndPtr
!= NULL
) &&
1178 ((wndPtr
->dwStyle
& (WS_VISIBLE
| WS_DISABLED
)) == WS_VISIBLE
) )
1180 dlgCode
= SendMessageA( hwndControl
, WM_GETDLGCODE
, 0, 0 );
1181 if ( (dlgCode
& (DLGC_BUTTON
| DLGC_STATIC
)) &&
1182 (wndPtr
->text
!=NULL
))
1184 /* find the accelerator key */
1185 LPSTR p
= wndPtr
->text
- 2;
1188 p
= strchr( p
+ 2, '&' );
1190 while (p
!= NULL
&& p
[1] == '&');
1192 /* and check if it's the one we're looking for */
1193 if (p
!= NULL
&& toupper( p
[1] ) == toupper( vKey
) )
1195 if ((dlgCode
& DLGC_STATIC
) ||
1196 (wndPtr
->dwStyle
& 0x0f) == BS_GROUPBOX
)
1198 /* set focus to the control */
1199 SendMessageA( hwndDlg
, WM_NEXTDLGCTL
,
1201 /* and bump it on to next */
1202 SendMessageA( hwndDlg
, WM_NEXTDLGCTL
, 0, 0);
1204 else if (dlgCode
& DLGC_BUTTON
)
1206 /* send BM_CLICK message to the control */
1207 SendMessageA( hwndControl
, BM_CLICK
, 0, 0 );
1211 WIN_ReleaseWndPtr(wndPtr
);
1215 hwndNext
= GetWindow( hwndControl
, GW_CHILD
);
1221 WIN_ReleaseWndPtr(wndPtr
);
1224 hwndNext
= GetWindow( hwndControl
, GW_HWNDNEXT
);
1226 while (!hwndNext
&& hwndControl
)
1228 hwndControl
= GetParent( hwndControl
);
1229 if (hwndControl
== hwndDlg
)
1231 if(hwnd
==hwndDlg
){ /* prevent endless loop */
1235 hwndNext
= GetWindow( hwndDlg
, GW_CHILD
);
1239 hwndNext
= GetWindow( hwndControl
, GW_HWNDNEXT
);
1242 hwndControl
= hwndNext
;
1244 while (hwndControl
&& (hwndControl
!= hwnd
));
1249 /***********************************************************************
1250 * DIALOG_FindMsgDestination
1252 * The messages that IsDialogMessage send may not go to the dialog
1253 * calling IsDialogMessage if that dialog is a child, and it has the
1254 * DS_CONTROL style set.
1255 * We propagate up until we hit a that does not have DS_CONTROL, or
1256 * whose parent is not a dialog.
1258 * This is undocumented behaviour.
1260 static HWND
DIALOG_FindMsgDestination( HWND hwndDlg
)
1262 while (GetWindowLongA(hwndDlg
, GWL_STYLE
) & DS_CONTROL
)
1265 HWND hParent
= GetParent(hwndDlg
);
1266 if (!hParent
) break;
1268 pParent
= WIN_FindWndPtr(hParent
);
1269 if (!pParent
) break;
1271 if (!(pParent
->flags
& WIN_ISDIALOG
))
1273 WIN_ReleaseWndPtr(pParent
);
1276 WIN_ReleaseWndPtr(pParent
);
1284 /***********************************************************************
1285 * DIALOG_IsDialogMessage
1287 static BOOL
DIALOG_IsDialogMessage( HWND hwnd
, HWND hwndDlg
,
1288 UINT message
, WPARAM wParam
,
1289 LPARAM lParam
, BOOL
*translate
,
1290 BOOL
*dispatch
, INT dlgCode
)
1292 *translate
= *dispatch
= FALSE
;
1294 if (message
== WM_PAINT
)
1296 /* Apparently, we have to handle this one as well */
1301 /* Only the key messages get special processing */
1302 if ((message
!= WM_KEYDOWN
) &&
1303 (message
!= WM_SYSCHAR
) &&
1304 (message
!= WM_CHAR
))
1307 if (dlgCode
& DLGC_WANTMESSAGE
)
1309 *translate
= *dispatch
= TRUE
;
1313 hwndDlg
= DIALOG_FindMsgDestination(hwndDlg
);
1321 if (!(dlgCode
& DLGC_WANTTAB
))
1323 SendMessageA( hwndDlg
, WM_NEXTDLGCTL
,
1324 (GetKeyState(VK_SHIFT
) & 0x8000), 0 );
1333 if (!(dlgCode
& DLGC_WANTARROWS
))
1335 BOOL fPrevious
= (wParam
== VK_LEFT
|| wParam
== VK_UP
);
1337 GetNextDlgGroupItem (hwndDlg
, GetFocus(), fPrevious
);
1338 SendMessageA( hwndDlg
, WM_NEXTDLGCTL
, hwndNext
, 1 );
1344 SendMessageA( hwndDlg
, WM_COMMAND
, IDCANCEL
,
1345 (LPARAM
)GetDlgItem( hwndDlg
, IDCANCEL
) );
1350 DWORD dw
= SendMessage16( hwndDlg
, DM_GETDEFID
, 0, 0 );
1351 if (HIWORD(dw
) == DC_HASDEFID
)
1353 SendMessageA( hwndDlg
, WM_COMMAND
,
1354 MAKEWPARAM( LOWORD(dw
), BN_CLICKED
),
1355 (LPARAM
)GetDlgItem(hwndDlg
, LOWORD(dw
)));
1359 SendMessageA( hwndDlg
, WM_COMMAND
, IDOK
,
1360 (LPARAM
)GetDlgItem( hwndDlg
, IDOK
) );
1367 break; /* case WM_KEYDOWN */
1370 if (dlgCode
& DLGC_WANTCHARS
) break;
1374 if (DIALOG_IsAccelerator( hwnd
, hwndDlg
, wParam
))
1376 /* don't translate or dispatch */
1382 /* If we get here, the message has not been treated specially */
1383 /* and can be sent to its destination window. */
1389 /***********************************************************************
1390 * IsDialogMessage16 (USER.90)
1392 BOOL16 WINAPI
WIN16_IsDialogMessage16( HWND16 hwndDlg
, SEGPTR msg16
)
1394 LPMSG16 msg
= PTR_SEG_TO_LIN(msg16
);
1395 BOOL ret
, translate
, dispatch
;
1398 if ((hwndDlg
!= msg
->hwnd
) && !IsChild16( hwndDlg
, msg
->hwnd
))
1401 if ((msg
->message
== WM_KEYDOWN
) ||
1402 (msg
->message
== WM_SYSCHAR
) ||
1403 (msg
->message
== WM_CHAR
))
1405 dlgCode
= SendMessage16( msg
->hwnd
, WM_GETDLGCODE
, 0, (LPARAM
)msg16
);
1407 ret
= DIALOG_IsDialogMessage( msg
->hwnd
, hwndDlg
, msg
->message
,
1408 msg
->wParam
, msg
->lParam
,
1409 &translate
, &dispatch
, dlgCode
);
1410 if (translate
) TranslateMessage16( msg
);
1411 if (dispatch
) DispatchMessage16( msg
);
1416 BOOL16 WINAPI
IsDialogMessage16( HWND16 hwndDlg
, LPMSG16 msg
)
1418 LPMSG16 msg16
= SEGPTR_NEW(MSG16
);
1422 ret
= WIN16_IsDialogMessage16( hwndDlg
, SEGPTR_GET(msg16
) );
1427 /***********************************************************************
1428 * IsDialogMessageA (USER32.342)
1430 BOOL WINAPI
IsDialogMessageA( HWND hwndDlg
, LPMSG msg
)
1432 BOOL ret
, translate
, dispatch
;
1435 if ((hwndDlg
!= msg
->hwnd
) && !IsChild( hwndDlg
, msg
->hwnd
))
1438 if ((msg
->message
== WM_KEYDOWN
) ||
1439 (msg
->message
== WM_SYSCHAR
) ||
1440 (msg
->message
== WM_CHAR
))
1442 dlgCode
= SendMessageA( msg
->hwnd
, WM_GETDLGCODE
, 0, (LPARAM
)msg
);
1444 ret
= DIALOG_IsDialogMessage( msg
->hwnd
, hwndDlg
, msg
->message
,
1445 msg
->wParam
, msg
->lParam
,
1446 &translate
, &dispatch
, dlgCode
);
1447 if (translate
) TranslateMessage( msg
);
1448 if (dispatch
) DispatchMessageA( msg
);
1453 /***********************************************************************
1454 * IsDialogMessageW (USER32.343)
1456 BOOL WINAPI
IsDialogMessageW( HWND hwndDlg
, LPMSG msg
)
1458 BOOL ret
, translate
, dispatch
;
1461 if ((hwndDlg
!= msg
->hwnd
) && !IsChild( hwndDlg
, msg
->hwnd
))
1464 if ((msg
->message
== WM_KEYDOWN
) ||
1465 (msg
->message
== WM_SYSCHAR
) ||
1466 (msg
->message
== WM_CHAR
))
1468 dlgCode
= SendMessageW( msg
->hwnd
, WM_GETDLGCODE
, 0, (LPARAM
)msg
);
1470 ret
= DIALOG_IsDialogMessage( msg
->hwnd
, hwndDlg
, msg
->message
,
1471 msg
->wParam
, msg
->lParam
,
1472 &translate
, &dispatch
, dlgCode
);
1473 if (translate
) TranslateMessage( msg
);
1474 if (dispatch
) DispatchMessageW( msg
);
1479 /***********************************************************************
1480 * GetDlgCtrlID16 (USER.277)
1482 INT16 WINAPI
GetDlgCtrlID16( HWND16 hwnd
)
1484 WND
*wndPtr
= WIN_FindWndPtr(hwnd
);
1487 if (!wndPtr
) return 0;
1489 retvalue
= wndPtr
->wIDmenu
;
1490 WIN_ReleaseWndPtr(wndPtr
);
1495 /***********************************************************************
1496 * GetDlgCtrlID (USER32.234)
1498 INT WINAPI
GetDlgCtrlID( HWND hwnd
)
1501 WND
*wndPtr
= WIN_FindWndPtr(hwnd
);
1502 if (!wndPtr
) return 0;
1503 retvalue
= wndPtr
->wIDmenu
;
1504 WIN_ReleaseWndPtr(wndPtr
);
1509 /***********************************************************************
1510 * GetDlgItem16 (USER.91)
1512 HWND16 WINAPI
GetDlgItem16( HWND16 hwndDlg
, INT16 id
)
1516 if (!(pWnd
= WIN_FindWndPtr( hwndDlg
))) return 0;
1517 for (WIN_UpdateWndPtr(&pWnd
,pWnd
->child
); pWnd
; WIN_UpdateWndPtr(&pWnd
,pWnd
->next
))
1518 if (pWnd
->wIDmenu
== (UINT16
)id
)
1520 HWND16 retvalue
= pWnd
->hwndSelf
;
1521 WIN_ReleaseWndPtr(pWnd
);
1528 /***********************************************************************
1529 * GetDlgItem (USER32.235)
1531 HWND WINAPI
GetDlgItem( HWND hwndDlg
, INT id
)
1535 if (!(pWnd
= WIN_FindWndPtr( hwndDlg
))) return 0;
1536 for (WIN_UpdateWndPtr(&pWnd
,pWnd
->child
); pWnd
;WIN_UpdateWndPtr(&pWnd
,pWnd
->next
))
1537 if (pWnd
->wIDmenu
== (UINT16
)id
)
1539 HWND retvalue
= pWnd
->hwndSelf
;
1540 WIN_ReleaseWndPtr(pWnd
);
1547 /*******************************************************************
1548 * SendDlgItemMessage16 (USER.101)
1550 LRESULT WINAPI
SendDlgItemMessage16( HWND16 hwnd
, INT16 id
, UINT16 msg
,
1551 WPARAM16 wParam
, LPARAM lParam
)
1553 HWND16 hwndCtrl
= GetDlgItem16( hwnd
, id
);
1554 if (hwndCtrl
) return SendMessage16( hwndCtrl
, msg
, wParam
, lParam
);
1559 /*******************************************************************
1560 * SendDlgItemMessageA (USER32.452)
1562 LRESULT WINAPI
SendDlgItemMessageA( HWND hwnd
, INT id
, UINT msg
,
1563 WPARAM wParam
, LPARAM lParam
)
1565 HWND hwndCtrl
= GetDlgItem( hwnd
, id
);
1566 if (hwndCtrl
) return SendMessageA( hwndCtrl
, msg
, wParam
, lParam
);
1571 /*******************************************************************
1572 * SendDlgItemMessageW (USER32.453)
1574 LRESULT WINAPI
SendDlgItemMessageW( HWND hwnd
, INT id
, UINT msg
,
1575 WPARAM wParam
, LPARAM lParam
)
1577 HWND hwndCtrl
= GetDlgItem( hwnd
, id
);
1578 if (hwndCtrl
) return SendMessageW( hwndCtrl
, msg
, wParam
, lParam
);
1583 /*******************************************************************
1584 * SetDlgItemText16 (USER.92)
1586 void WINAPI
SetDlgItemText16( HWND16 hwnd
, INT16 id
, SEGPTR lpString
)
1588 SendDlgItemMessage16( hwnd
, id
, WM_SETTEXT
, 0, (LPARAM
)lpString
);
1592 /*******************************************************************
1593 * SetDlgItemTextA (USER32.478)
1595 BOOL WINAPI
SetDlgItemTextA( HWND hwnd
, INT id
, LPCSTR lpString
)
1597 return SendDlgItemMessageA( hwnd
, id
, WM_SETTEXT
, 0, (LPARAM
)lpString
);
1601 /*******************************************************************
1602 * SetDlgItemTextW (USER32.479)
1604 BOOL WINAPI
SetDlgItemTextW( HWND hwnd
, INT id
, LPCWSTR lpString
)
1606 return SendDlgItemMessageW( hwnd
, id
, WM_SETTEXT
, 0, (LPARAM
)lpString
);
1610 /***********************************************************************
1611 * GetDlgItemText16 (USER.93)
1613 INT16 WINAPI
GetDlgItemText16( HWND16 hwnd
, INT16 id
, SEGPTR str
, UINT16 len
)
1615 return (INT16
)SendDlgItemMessage16( hwnd
, id
, WM_GETTEXT
,
1620 /***********************************************************************
1621 * GetDlgItemTextA (USER32.237)
1623 INT WINAPI
GetDlgItemTextA( HWND hwnd
, INT id
, LPSTR str
, UINT len
)
1625 return (INT
)SendDlgItemMessageA( hwnd
, id
, WM_GETTEXT
,
1630 /***********************************************************************
1631 * GetDlgItemTextW (USER32.238)
1633 INT WINAPI
GetDlgItemTextW( HWND hwnd
, INT id
, LPWSTR str
, UINT len
)
1635 return (INT
)SendDlgItemMessageW( hwnd
, id
, WM_GETTEXT
,
1640 /*******************************************************************
1641 * SetDlgItemInt16 (USER.94)
1643 void WINAPI
SetDlgItemInt16( HWND16 hwnd
, INT16 id
, UINT16 value
, BOOL16 fSigned
)
1645 SetDlgItemInt( hwnd
, (UINT
)(UINT16
)id
, value
, fSigned
);
1649 /*******************************************************************
1650 * SetDlgItemInt (USER32.477)
1652 BOOL WINAPI
SetDlgItemInt( HWND hwnd
, INT id
, UINT value
,
1657 if (fSigned
) sprintf( str
, "%d", (INT
)value
);
1658 else sprintf( str
, "%u", value
);
1659 SendDlgItemMessageA( hwnd
, id
, WM_SETTEXT
, 0, (LPARAM
)str
);
1664 /***********************************************************************
1665 * GetDlgItemInt16 (USER.95)
1667 UINT16 WINAPI
GetDlgItemInt16( HWND16 hwnd
, INT16 id
, BOOL16
*translated
,
1673 if (translated
) *translated
= FALSE
;
1674 result
= GetDlgItemInt( hwnd
, (UINT
)(UINT16
)id
, &ok
, fSigned
);
1678 if (((INT
)result
< -32767) || ((INT
)result
> 32767)) return 0;
1682 if (result
> 65535) return 0;
1684 if (translated
) *translated
= TRUE
;
1685 return (UINT16
)result
;
1689 /***********************************************************************
1690 * GetDlgItemInt (USER32.236)
1692 UINT WINAPI
GetDlgItemInt( HWND hwnd
, INT id
, BOOL
*translated
,
1699 if (translated
) *translated
= FALSE
;
1700 if (!SendDlgItemMessageA(hwnd
, id
, WM_GETTEXT
, sizeof(str
), (LPARAM
)str
))
1704 result
= strtol( str
, &endptr
, 10 );
1705 if (!endptr
|| (endptr
== str
)) /* Conversion was unsuccessful */
1707 if (((result
== LONG_MIN
) || (result
== LONG_MAX
)) && (errno
==ERANGE
))
1712 result
= strtoul( str
, &endptr
, 10 );
1713 if (!endptr
|| (endptr
== str
)) /* Conversion was unsuccessful */
1715 if ((result
== ULONG_MAX
) && (errno
== ERANGE
)) return 0;
1717 if (translated
) *translated
= TRUE
;
1718 return (UINT
)result
;
1722 /***********************************************************************
1723 * CheckDlgButton16 (USER.97)
1725 BOOL16 WINAPI
CheckDlgButton16( HWND16 hwnd
, INT16 id
, UINT16 check
)
1727 SendDlgItemMessageA( hwnd
, id
, BM_SETCHECK
, check
, 0 );
1732 /***********************************************************************
1733 * CheckDlgButton (USER32.45)
1735 BOOL WINAPI
CheckDlgButton( HWND hwnd
, INT id
, UINT check
)
1737 SendDlgItemMessageA( hwnd
, id
, BM_SETCHECK
, check
, 0 );
1742 /***********************************************************************
1743 * IsDlgButtonChecked16 (USER.98)
1745 UINT16 WINAPI
IsDlgButtonChecked16( HWND16 hwnd
, UINT16 id
)
1747 return (UINT16
)SendDlgItemMessageA( hwnd
, id
, BM_GETCHECK
, 0, 0 );
1751 /***********************************************************************
1752 * IsDlgButtonChecked (USER32.344)
1754 UINT WINAPI
IsDlgButtonChecked( HWND hwnd
, UINT id
)
1756 return (UINT
)SendDlgItemMessageA( hwnd
, id
, BM_GETCHECK
, 0, 0 );
1760 /***********************************************************************
1761 * CheckRadioButton16 (USER.96)
1763 BOOL16 WINAPI
CheckRadioButton16( HWND16 hwndDlg
, UINT16 firstID
,
1764 UINT16 lastID
, UINT16 checkID
)
1766 return CheckRadioButton( hwndDlg
, firstID
, lastID
, checkID
);
1770 /***********************************************************************
1773 * Callback function used to check/uncheck radio buttons that fall
1774 * within a specific range of IDs.
1776 static BOOL CALLBACK
CheckRB(HWND hwndChild
, LPARAM lParam
)
1778 LONG lChildID
= GetWindowLongA(hwndChild
, GWL_ID
);
1779 RADIOGROUP
*lpRadioGroup
= (RADIOGROUP
*) lParam
;
1781 if ((lChildID
>= lpRadioGroup
->firstID
) &&
1782 (lChildID
<= lpRadioGroup
->lastID
))
1784 if (lChildID
== lpRadioGroup
->checkID
)
1786 SendMessageA(hwndChild
, BM_SETCHECK
, BST_CHECKED
, 0);
1790 SendMessageA(hwndChild
, BM_SETCHECK
, BST_UNCHECKED
, 0);
1798 /***********************************************************************
1799 * CheckRadioButton (USER32.48)
1801 BOOL WINAPI
CheckRadioButton( HWND hwndDlg
, UINT firstID
,
1802 UINT lastID
, UINT checkID
)
1804 RADIOGROUP radioGroup
;
1806 /* perform bounds checking for a radio button group */
1807 radioGroup
.firstID
= min(min(firstID
, lastID
), checkID
);
1808 radioGroup
.lastID
= max(max(firstID
, lastID
), checkID
);
1809 radioGroup
.checkID
= checkID
;
1811 return EnumChildWindows(hwndDlg
, (WNDENUMPROC
)CheckRB
,
1812 (LPARAM
)&radioGroup
);
1816 /***********************************************************************
1817 * GetDialogBaseUnits (USER.243) (USER32.233)
1819 DWORD WINAPI
GetDialogBaseUnits(void)
1821 return MAKELONG( xBaseUnit
, yBaseUnit
);
1825 /***********************************************************************
1826 * MapDialogRect16 (USER.103)
1828 void WINAPI
MapDialogRect16( HWND16 hwnd
, LPRECT16 rect
)
1830 DIALOGINFO
* dlgInfo
;
1831 WND
* wndPtr
= WIN_FindWndPtr( hwnd
);
1832 if (!wndPtr
) return;
1833 dlgInfo
= (DIALOGINFO
*)wndPtr
->wExtra
;
1834 rect
->left
= MulDiv(rect
->left
, dlgInfo
->xBaseUnit
, 4);
1835 rect
->right
= MulDiv(rect
->right
, dlgInfo
->xBaseUnit
, 4);
1836 rect
->top
= MulDiv(rect
->top
, dlgInfo
->yBaseUnit
, 8);
1837 rect
->bottom
= MulDiv(rect
->bottom
, dlgInfo
->yBaseUnit
, 8);
1838 WIN_ReleaseWndPtr(wndPtr
);
1842 /***********************************************************************
1843 * MapDialogRect (USER32.382)
1845 BOOL WINAPI
MapDialogRect( HWND hwnd
, LPRECT rect
)
1847 DIALOGINFO
* dlgInfo
;
1848 WND
* wndPtr
= WIN_FindWndPtr( hwnd
);
1849 if (!wndPtr
) return FALSE
;
1850 dlgInfo
= (DIALOGINFO
*)wndPtr
->wExtra
;
1851 rect
->left
= MulDiv(rect
->left
, dlgInfo
->xBaseUnit
, 4);
1852 rect
->right
= MulDiv(rect
->right
, dlgInfo
->xBaseUnit
, 4);
1853 rect
->top
= MulDiv(rect
->top
, dlgInfo
->yBaseUnit
, 8);
1854 rect
->bottom
= MulDiv(rect
->bottom
, dlgInfo
->yBaseUnit
, 8);
1855 WIN_ReleaseWndPtr(wndPtr
);
1860 /***********************************************************************
1861 * GetNextDlgGroupItem16 (USER.227)
1863 HWND16 WINAPI
GetNextDlgGroupItem16( HWND16 hwndDlg
, HWND16 hwndCtrl
,
1866 return (HWND16
)GetNextDlgGroupItem( hwndDlg
, hwndCtrl
, fPrevious
);
1870 /***********************************************************************
1871 * GetNextDlgGroupItem (USER32.275)
1873 HWND WINAPI
GetNextDlgGroupItem( HWND hwndDlg
, HWND hwndCtrl
,
1884 /* if the hwndCtrl is the child of the control in the hwndDlg then the hwndDlg has to be the parent of the hwndCtrl */
1885 if(GetParent(hwndCtrl
) != hwndDlg
&& GetParent(GetParent(hwndCtrl
)) == hwndDlg
)
1886 hwndDlg
= GetParent(hwndCtrl
);
1889 if (!(pWndDlg
= WIN_FindWndPtr( hwndDlg
))) return 0;
1892 if (!(pWndCtrl
= WIN_FindWndPtr( hwndCtrl
)))
1897 /* Make sure hwndCtrl is a top-level child */
1898 while ((pWndCtrl
->dwStyle
& WS_CHILD
) && (pWndCtrl
->parent
!= pWndDlg
))
1899 WIN_UpdateWndPtr(&pWndCtrl
,pWndCtrl
->parent
);
1900 if (pWndCtrl
->parent
!= pWndDlg
)
1908 /* No ctrl specified -> start from the beginning */
1909 if (!(pWndCtrl
= WIN_LockWndPtr(pWndDlg
->child
)))
1915 while (pWndCtrl
->next
) WIN_UpdateWndPtr(&pWndCtrl
,pWndCtrl
->next
);
1918 pWndLast
= WIN_LockWndPtr(pWndCtrl
);
1919 pWnd
= WIN_LockWndPtr(pWndCtrl
->next
);
1923 if (!pWnd
|| (pWnd
->dwStyle
& WS_GROUP
))
1925 /* Wrap-around to the beginning of the group */
1928 WIN_UpdateWndPtr( &pWnd
, pWndDlg
->child
);
1929 for ( pWndTemp
= WIN_LockWndPtr( pWnd
);
1931 WIN_UpdateWndPtr( &pWndTemp
, pWndTemp
->next
) )
1933 if (pWndTemp
->dwStyle
& WS_GROUP
) WIN_UpdateWndPtr( &pWnd
, pWndTemp
);
1934 if (pWndTemp
== pWndCtrl
) break;
1936 WIN_ReleaseWndPtr( pWndTemp
);
1938 if (pWnd
== pWndCtrl
) break;
1939 if ((pWnd
->dwStyle
& WS_VISIBLE
) && !(pWnd
->dwStyle
& WS_DISABLED
))
1941 WIN_UpdateWndPtr(&pWndLast
,pWnd
);
1942 if (!fPrevious
) break;
1944 WIN_UpdateWndPtr(&pWnd
,pWnd
->next
);
1946 retvalue
= pWndLast
->hwndSelf
;
1948 WIN_ReleaseWndPtr(pWndLast
);
1949 WIN_ReleaseWndPtr(pWnd
);
1951 WIN_ReleaseWndPtr(pWndCtrl
);
1952 WIN_ReleaseWndPtr(pWndDlg
);
1958 /***********************************************************************
1959 * GetNextDlgTabItem16 (USER.228)
1961 HWND16 WINAPI
GetNextDlgTabItem16( HWND16 hwndDlg
, HWND16 hwndCtrl
,
1964 return (HWND16
)GetNextDlgTabItem( hwndDlg
, hwndCtrl
, fPrevious
);
1967 /***********************************************************************
1968 * DIALOG_GetNextTabItem
1970 * Helper for GetNextDlgTabItem
1972 static HWND
DIALOG_GetNextTabItem( HWND hwndMain
, HWND hwndDlg
, HWND hwndCtrl
, BOOL fPrevious
)
1976 UINT wndSearch
= fPrevious
? GW_HWNDPREV
: GW_HWNDNEXT
;
1978 HWND hChildFirst
= 0;
1982 hChildFirst
= GetWindow(hwndDlg
,GW_CHILD
);
1983 if(fPrevious
) hChildFirst
= GetWindow(hChildFirst
,GW_HWNDLAST
);
1987 HWND hParent
= GetParent(hwndCtrl
);
1988 BOOL bValid
= FALSE
;
1991 if(hParent
== hwndMain
)
1996 hParent
= GetParent(hParent
);
2000 hChildFirst
= GetWindow(hwndCtrl
,wndSearch
);
2003 if(GetParent(hwndCtrl
) != hwndMain
)
2004 hChildFirst
= GetWindow(GetParent(hwndCtrl
),wndSearch
);
2008 hChildFirst
= GetWindow(hwndCtrl
,GW_HWNDLAST
);
2010 hChildFirst
= GetWindow(hwndCtrl
,GW_HWNDFIRST
);
2020 dsStyle
= GetWindowLongA(hChildFirst
,GWL_STYLE
);
2021 exStyle
= GetWindowLongA(hChildFirst
,GWL_EXSTYLE
);
2022 if( (dsStyle
& DS_CONTROL
|| exStyle
& WS_EX_CONTROLPARENT
) && (dsStyle
& WS_VISIBLE
) && !(dsStyle
& WS_DISABLED
))
2027 else if( (dsStyle
& WS_TABSTOP
) && (dsStyle
& WS_VISIBLE
) && !(dsStyle
& WS_DISABLED
))
2029 hChildFirst
= GetWindow(hChildFirst
,wndSearch
);
2034 retWnd
= DIALOG_GetNextTabItem(hwndMain
,hChildFirst
,(HWND
)NULL
,fPrevious
);
2036 retWnd
= hChildFirst
;
2039 hChildFirst
= GetWindow(hChildFirst
,wndSearch
);
2041 if(!retWnd
&& hwndCtrl
)
2043 HWND hParent
= GetParent(hwndCtrl
);
2046 if(hParent
== hwndMain
) break;
2047 retWnd
= DIALOG_GetNextTabItem(hwndMain
,GetParent(hParent
),hParent
,fPrevious
);
2049 hParent
= GetParent(hParent
);
2052 retWnd
= DIALOG_GetNextTabItem(hwndMain
,hwndMain
,(HWND
)NULL
,fPrevious
);
2057 /***********************************************************************
2058 * GetNextDlgTabItem (USER32.276)
2060 HWND WINAPI
GetNextDlgTabItem( HWND hwndDlg
, HWND hwndCtrl
,
2063 return DIALOG_GetNextTabItem(hwndDlg
,hwndDlg
,hwndCtrl
,fPrevious
);
2066 /**********************************************************************
2067 * DIALOG_DlgDirSelect
2069 * Helper function for DlgDirSelect*
2071 static BOOL
DIALOG_DlgDirSelect( HWND hwnd
, LPSTR str
, INT len
,
2072 INT id
, BOOL win32
, BOOL unicode
,
2078 HWND listbox
= GetDlgItem( hwnd
, id
);
2080 TRACE("%04x '%s' %d\n", hwnd
, str
, id
);
2081 if (!listbox
) return FALSE
;
2084 item
= SendMessageA(listbox
, combo
? CB_GETCURSEL
2085 : LB_GETCURSEL
, 0, 0 );
2086 if (item
== LB_ERR
) return FALSE
;
2087 size
= SendMessageA(listbox
, combo
? CB_GETLBTEXTLEN
2088 : LB_GETTEXTLEN
, 0, 0 );
2089 if (size
== LB_ERR
) return FALSE
;
2093 item
= SendMessageA(listbox
, combo
? CB_GETCURSEL16
2094 : LB_GETCURSEL16
, 0, 0 );
2095 if (item
== LB_ERR
) return FALSE
;
2096 size
= SendMessageA(listbox
, combo
? CB_GETLBTEXTLEN16
2097 : LB_GETTEXTLEN16
, 0, 0 );
2098 if (size
== LB_ERR
) return FALSE
;
2101 if (!(buffer
= SEGPTR_ALLOC( size
+1 ))) return FALSE
;
2104 SendMessageA( listbox
, combo
? CB_GETLBTEXT
: LB_GETTEXT
,
2105 item
, (LPARAM
)buffer
);
2107 SendMessage16( listbox
, combo
? CB_GETLBTEXT16
: LB_GETTEXT16
,
2108 item
, (LPARAM
)SEGPTR_GET(buffer
) );
2110 if ((ret
= (buffer
[0] == '['))) /* drive or directory */
2112 if (buffer
[1] == '-') /* drive */
2120 buffer
[strlen(buffer
)-1] = '\\';
2126 if (unicode
) lstrcpynAtoW( (LPWSTR
)str
, ptr
, len
);
2127 else lstrcpynA( str
, ptr
, len
);
2128 SEGPTR_FREE( buffer
);
2129 TRACE("Returning %d '%s'\n", ret
, str
);
2134 /**********************************************************************
2137 * Helper function for DlgDirList*
2139 static INT
DIALOG_DlgDirList( HWND hDlg
, LPSTR spec
, INT idLBox
,
2140 INT idStatic
, UINT attrib
, BOOL combo
)
2144 LPSTR orig_spec
= spec
;
2146 #define SENDMSG(msg,wparam,lparam) \
2147 ((attrib & DDL_POSTMSGS) ? PostMessageA( hwnd, msg, wparam, lparam ) \
2148 : SendMessageA( hwnd, msg, wparam, lparam ))
2150 TRACE("%04x '%s' %d %d %04x\n",
2151 hDlg
, spec
? spec
: "NULL", idLBox
, idStatic
, attrib
);
2153 if (spec
&& spec
[0] && (spec
[1] == ':'))
2155 drive
= toupper( spec
[0] ) - 'A';
2157 if (!DRIVE_SetCurrentDrive( drive
)) return FALSE
;
2159 else drive
= DRIVE_GetCurrentDrive();
2161 /* If the path exists and is a directory, chdir to it */
2162 if (!spec
|| !spec
[0] || DRIVE_Chdir( drive
, spec
)) spec
= "*.*";
2167 if ((p2
= strrchr( p
, '\\' ))) p
= p2
;
2168 if ((p2
= strrchr( p
, '/' ))) p
= p2
;
2173 if (!DRIVE_Chdir( drive
, spec
))
2175 *p
= sep
; /* Restore the original spec */
2182 TRACE("path=%c:\\%s mask=%s\n",
2183 'A' + drive
, DRIVE_GetDosCwd(drive
), spec
);
2185 if (idLBox
&& ((hwnd
= GetDlgItem( hDlg
, idLBox
)) != 0))
2187 SENDMSG( combo
? CB_RESETCONTENT
: LB_RESETCONTENT
, 0, 0 );
2188 if (attrib
& DDL_DIRECTORY
)
2190 if (!(attrib
& DDL_EXCLUSIVE
))
2192 if (SENDMSG( combo
? CB_DIR
: LB_DIR
,
2193 attrib
& ~(DDL_DIRECTORY
| DDL_DRIVES
),
2194 (LPARAM
)spec
) == LB_ERR
)
2197 if (SENDMSG( combo
? CB_DIR
: LB_DIR
,
2198 (attrib
& (DDL_DIRECTORY
| DDL_DRIVES
)) | DDL_EXCLUSIVE
,
2199 (LPARAM
)"*.*" ) == LB_ERR
)
2204 if (SENDMSG( combo
? CB_DIR
: LB_DIR
, attrib
,
2205 (LPARAM
)spec
) == LB_ERR
)
2210 if (idStatic
&& ((hwnd
= GetDlgItem( hDlg
, idStatic
)) != 0))
2213 int drive
= DRIVE_GetCurrentDrive();
2214 strcpy( temp
, "A:\\" );
2216 lstrcpynA( temp
+ 3, DRIVE_GetDosCwd(drive
), sizeof(temp
)-3 );
2218 /* Can't use PostMessage() here, because the string is on the stack */
2219 SetDlgItemTextA( hDlg
, idStatic
, temp
);
2222 if (orig_spec
&& (spec
!= orig_spec
))
2224 /* Update the original file spec */
2226 while ((*orig_spec
++ = *p
++));
2234 /**********************************************************************
2235 * DIALOG_DlgDirListW
2237 * Helper function for DlgDirList*W
2239 static INT
DIALOG_DlgDirListW( HWND hDlg
, LPWSTR spec
, INT idLBox
,
2240 INT idStatic
, UINT attrib
, BOOL combo
)
2244 LPSTR specA
= HEAP_strdupWtoA( GetProcessHeap(), 0, spec
);
2245 INT ret
= DIALOG_DlgDirList( hDlg
, specA
, idLBox
, idStatic
,
2247 lstrcpyAtoW( spec
, specA
);
2248 HeapFree( GetProcessHeap(), 0, specA
);
2251 return DIALOG_DlgDirList( hDlg
, NULL
, idLBox
, idStatic
, attrib
, combo
);
2255 /**********************************************************************
2256 * DlgDirSelect (USER.99)
2258 BOOL16 WINAPI
DlgDirSelect16( HWND16 hwnd
, LPSTR str
, INT16 id
)
2260 return DlgDirSelectEx16( hwnd
, str
, 128, id
);
2264 /**********************************************************************
2265 * DlgDirSelectComboBox (USER.194)
2267 BOOL16 WINAPI
DlgDirSelectComboBox16( HWND16 hwnd
, LPSTR str
, INT16 id
)
2269 return DlgDirSelectComboBoxEx16( hwnd
, str
, 128, id
);
2273 /**********************************************************************
2274 * DlgDirSelectEx16 (USER.422)
2276 BOOL16 WINAPI
DlgDirSelectEx16( HWND16 hwnd
, LPSTR str
, INT16 len
, INT16 id
)
2278 return DIALOG_DlgDirSelect( hwnd
, str
, len
, id
, FALSE
, FALSE
, FALSE
);
2282 /**********************************************************************
2283 * DlgDirSelectExA (USER32.149)
2285 BOOL WINAPI
DlgDirSelectExA( HWND hwnd
, LPSTR str
, INT len
, INT id
)
2287 return DIALOG_DlgDirSelect( hwnd
, str
, len
, id
, TRUE
, FALSE
, FALSE
);
2291 /**********************************************************************
2292 * DlgDirSelectExW (USER32.150)
2294 BOOL WINAPI
DlgDirSelectExW( HWND hwnd
, LPWSTR str
, INT len
, INT id
)
2296 return DIALOG_DlgDirSelect( hwnd
, (LPSTR
)str
, len
, id
, TRUE
, TRUE
, FALSE
);
2300 /**********************************************************************
2301 * DlgDirSelectComboBoxEx16 (USER.423)
2303 BOOL16 WINAPI
DlgDirSelectComboBoxEx16( HWND16 hwnd
, LPSTR str
, INT16 len
,
2306 return DIALOG_DlgDirSelect( hwnd
, str
, len
, id
, FALSE
, FALSE
, TRUE
);
2310 /**********************************************************************
2311 * DlgDirSelectComboBoxExA (USER32.147)
2313 BOOL WINAPI
DlgDirSelectComboBoxExA( HWND hwnd
, LPSTR str
, INT len
,
2316 return DIALOG_DlgDirSelect( hwnd
, str
, len
, id
, TRUE
, FALSE
, TRUE
);
2320 /**********************************************************************
2321 * DlgDirSelectComboBoxExW (USER32.148)
2323 BOOL WINAPI
DlgDirSelectComboBoxExW( HWND hwnd
, LPWSTR str
, INT len
,
2326 return DIALOG_DlgDirSelect( hwnd
, (LPSTR
)str
, len
, id
, TRUE
, TRUE
, TRUE
);
2330 /**********************************************************************
2331 * DlgDirList16 (USER.100)
2333 INT16 WINAPI
DlgDirList16( HWND16 hDlg
, LPSTR spec
, INT16 idLBox
,
2334 INT16 idStatic
, UINT16 attrib
)
2336 return DIALOG_DlgDirList( hDlg
, spec
, idLBox
, idStatic
, attrib
, FALSE
);
2340 /**********************************************************************
2341 * DlgDirListA (USER32.143)
2343 INT WINAPI
DlgDirListA( HWND hDlg
, LPSTR spec
, INT idLBox
,
2344 INT idStatic
, UINT attrib
)
2346 return DIALOG_DlgDirList( hDlg
, spec
, idLBox
, idStatic
, attrib
, FALSE
);
2350 /**********************************************************************
2351 * DlgDirListW (USER32.146)
2353 INT WINAPI
DlgDirListW( HWND hDlg
, LPWSTR spec
, INT idLBox
,
2354 INT idStatic
, UINT attrib
)
2356 return DIALOG_DlgDirListW( hDlg
, spec
, idLBox
, idStatic
, attrib
, FALSE
);
2360 /**********************************************************************
2361 * DlgDirListComboBox16 (USER.195)
2363 INT16 WINAPI
DlgDirListComboBox16( HWND16 hDlg
, LPSTR spec
, INT16 idCBox
,
2364 INT16 idStatic
, UINT16 attrib
)
2366 return DIALOG_DlgDirList( hDlg
, spec
, idCBox
, idStatic
, attrib
, TRUE
);
2370 /**********************************************************************
2371 * DlgDirListComboBoxA (USER32.144)
2373 INT WINAPI
DlgDirListComboBoxA( HWND hDlg
, LPSTR spec
, INT idCBox
,
2374 INT idStatic
, UINT attrib
)
2376 return DIALOG_DlgDirList( hDlg
, spec
, idCBox
, idStatic
, attrib
, TRUE
);
2380 /**********************************************************************
2381 * DlgDirListComboBoxW (USER32.145)
2383 INT WINAPI
DlgDirListComboBoxW( HWND hDlg
, LPWSTR spec
, INT idCBox
,
2384 INT idStatic
, UINT attrib
)
2386 return DIALOG_DlgDirListW( hDlg
, spec
, idCBox
, idStatic
, attrib
, TRUE
);