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 DIALOG_GetCharSize(hFont
,&charSize
);
695 TRACE("units = %d,%d\n", xUnit
, yUnit
);
698 /* Create dialog main window */
700 rect
.left
= rect
.top
= 0;
701 rect
.right
= MulDiv(template.cx
, xUnit
, 4);
702 rect
.bottom
= MulDiv(template.cy
, yUnit
, 8);
703 if (template.style
& DS_MODALFRAME
)
704 template.exStyle
|= WS_EX_DLGMODALFRAME
;
705 AdjustWindowRectEx( &rect
, template.style
,
706 hMenu
? TRUE
: FALSE
, template.exStyle
);
707 rect
.right
-= rect
.left
;
708 rect
.bottom
-= rect
.top
;
710 if ((INT16
)template.x
== CW_USEDEFAULT16
)
712 rect
.left
= rect
.top
= win32Template
? CW_USEDEFAULT
: CW_USEDEFAULT16
;
716 if (template.style
& DS_CENTER
)
718 rect
.left
= (GetSystemMetrics(SM_CXSCREEN
) - rect
.right
) / 2;
719 rect
.top
= (GetSystemMetrics(SM_CYSCREEN
) - rect
.bottom
) / 2;
723 rect
.left
+= MulDiv(template.x
, xUnit
, 4);
724 rect
.top
+= MulDiv(template.y
, yUnit
, 8);
726 if ( !(template.style
& WS_CHILD
) )
730 if( !(template.style
& DS_ABSALIGN
) )
731 ClientToScreen( owner
, (POINT
*)&rect
);
733 /* try to fit it into the desktop */
735 if( (dX
= rect
.left
+ rect
.right
+ GetSystemMetrics(SM_CXDLGFRAME
)
736 - GetSystemMetrics(SM_CXSCREEN
)) > 0 ) rect
.left
-= dX
;
737 if( (dY
= rect
.top
+ rect
.bottom
+ GetSystemMetrics(SM_CYDLGFRAME
)
738 - GetSystemMetrics(SM_CYSCREEN
)) > 0 ) rect
.top
-= dY
;
739 if( rect
.left
< 0 ) rect
.left
= 0;
740 if( rect
.top
< 0 ) rect
.top
= 0;
745 hwnd
= CreateWindowEx16(template.exStyle
, template.className
,
746 template.caption
, template.style
& ~WS_VISIBLE
,
747 rect
.left
, rect
.top
, rect
.right
, rect
.bottom
,
748 owner
, hMenu
, hInst
, NULL
);
750 hwnd
= CreateWindowExW(template.exStyle
, (LPCWSTR
)template.className
,
751 (LPCWSTR
)template.caption
,
752 template.style
& ~WS_VISIBLE
,
753 rect
.left
, rect
.top
, rect
.right
, rect
.bottom
,
754 owner
, hMenu
, hInst
, NULL
);
758 if (hFont
) DeleteObject( hFont
);
759 if (hMenu
) DestroyMenu( hMenu
);
762 wndPtr
= WIN_FindWndPtr( hwnd
);
763 wndPtr
->flags
|= WIN_ISDIALOG
;
764 wndPtr
->helpContext
= template.helpId
;
766 /* Initialise dialog extra data */
768 dlgInfo
= (DIALOGINFO
*)wndPtr
->wExtra
;
769 WINPROC_SetProc( &dlgInfo
->dlgProc
, (WNDPROC16
)dlgProc
, procType
, WIN_PROC_WINDOW
);
770 dlgInfo
->hUserFont
= hFont
;
771 dlgInfo
->hMenu
= hMenu
;
772 dlgInfo
->xBaseUnit
= xUnit
;
773 dlgInfo
->yBaseUnit
= yUnit
;
774 dlgInfo
->msgResult
= 0;
775 dlgInfo
->idResult
= 0;
777 dlgInfo
->hDialogHeap
= 0;
779 if (dlgInfo
->hUserFont
)
780 SendMessageA( hwnd
, WM_SETFONT
, (WPARAM
)dlgInfo
->hUserFont
, 0 );
782 /* Create controls */
784 if (DIALOG_CreateControls( wndPtr
, dlgTemplate
, &template,
785 hInst
, win32Template
))
787 HWND hwndPreInitFocus
;
789 /* Send initialisation messages and set focus */
791 dlgInfo
->hwndFocus
= GetNextDlgTabItem( hwnd
, 0, FALSE
);
793 hwndPreInitFocus
= GetFocus();
794 if (SendMessageA( hwnd
, WM_INITDIALOG
, (WPARAM
)dlgInfo
->hwndFocus
, param
))
796 /* check where the focus is again, some controls status might have changed in
798 dlgInfo
->hwndFocus
= GetNextDlgTabItem( hwnd
, 0, FALSE
);
799 SetFocus( dlgInfo
->hwndFocus
);
803 /* If the dlgproc has returned FALSE (indicating handling of keyboard focus)
804 but the focus has not changed, set the focus where we expect it. */
805 if ( (wndPtr
->dwStyle
& WS_VISIBLE
) && ( GetFocus() == hwndPreInitFocus
) )
807 dlgInfo
->hwndFocus
= GetNextDlgTabItem( hwnd
, 0, FALSE
);
808 SetFocus( dlgInfo
->hwndFocus
);
812 if (template.style
& WS_VISIBLE
&& !(wndPtr
->dwStyle
& WS_VISIBLE
))
814 ShowWindow( hwnd
, SW_SHOWNORMAL
); /* SW_SHOW doesn't always work */
815 UpdateWindow( hwnd
);
817 WIN_ReleaseWndPtr(wndPtr
);
820 WIN_ReleaseWndPtr(wndPtr
);
821 if( IsWindow(hwnd
) ) DestroyWindow( hwnd
);
826 /***********************************************************************
827 * CreateDialog16 (USER.89)
829 HWND16 WINAPI
CreateDialog16( HINSTANCE16 hInst
, SEGPTR dlgTemplate
,
830 HWND16 owner
, DLGPROC16 dlgProc
)
832 return CreateDialogParam16( hInst
, dlgTemplate
, owner
, dlgProc
, 0 );
836 /***********************************************************************
837 * CreateDialogParam16 (USER.241)
839 HWND16 WINAPI
CreateDialogParam16( HINSTANCE16 hInst
, SEGPTR dlgTemplate
,
840 HWND16 owner
, DLGPROC16 dlgProc
,
848 TRACE("%04x,%08lx,%04x,%08lx,%ld\n",
849 hInst
, (DWORD
)dlgTemplate
, owner
, (DWORD
)dlgProc
, param
);
851 if (!(hRsrc
= FindResource16( hInst
, dlgTemplate
, RT_DIALOG16
))) return 0;
852 if (!(hmem
= LoadResource16( hInst
, hRsrc
))) return 0;
853 if (!(data
= LockResource16( hmem
))) hwnd
= 0;
854 else hwnd
= CreateDialogIndirectParam16( hInst
, data
, owner
,
856 FreeResource16( hmem
);
860 /***********************************************************************
861 * CreateDialogParamA (USER32.73)
863 HWND WINAPI
CreateDialogParamA( HINSTANCE hInst
, LPCSTR name
,
864 HWND owner
, DLGPROC dlgProc
,
867 HANDLE hrsrc
= FindResourceA( hInst
, name
, RT_DIALOGA
);
868 if (!hrsrc
) return 0;
869 return CreateDialogIndirectParamA( hInst
,
870 (LPVOID
)LoadResource(hInst
, hrsrc
),
871 owner
, dlgProc
, param
);
875 /***********************************************************************
876 * CreateDialogParamW (USER32.74)
878 HWND WINAPI
CreateDialogParamW( HINSTANCE hInst
, LPCWSTR name
,
879 HWND owner
, DLGPROC dlgProc
,
882 HANDLE hrsrc
= FindResourceW( hInst
, name
, RT_DIALOGW
);
883 if (!hrsrc
) return 0;
884 return CreateDialogIndirectParamW( hInst
,
885 (LPVOID
)LoadResource(hInst
, hrsrc
),
886 owner
, dlgProc
, param
);
890 /***********************************************************************
891 * CreateDialogIndirect16 (USER.219)
893 HWND16 WINAPI
CreateDialogIndirect16( HINSTANCE16 hInst
, LPCVOID dlgTemplate
,
894 HWND16 owner
, DLGPROC16 dlgProc
)
896 return CreateDialogIndirectParam16( hInst
, dlgTemplate
, owner
, dlgProc
, 0);
900 /***********************************************************************
901 * CreateDialogIndirectParam16 (USER.242)
903 HWND16 WINAPI
CreateDialogIndirectParam16( HINSTANCE16 hInst
,
905 HWND16 owner
, DLGPROC16 dlgProc
,
908 return DIALOG_CreateIndirect( hInst
, dlgTemplate
, FALSE
, owner
,
909 dlgProc
, param
, WIN_PROC_16
);
913 /***********************************************************************
914 * CreateDialogIndirectParamA (USER32.69)
916 HWND WINAPI
CreateDialogIndirectParamA( HINSTANCE hInst
,
918 HWND owner
, DLGPROC dlgProc
,
921 return DIALOG_CreateIndirect( hInst
, dlgTemplate
, TRUE
, owner
,
922 (DLGPROC16
)dlgProc
, param
, WIN_PROC_32A
);
925 /***********************************************************************
926 * CreateDialogIndirectParamAorW (USER32.71)
928 HWND WINAPI
CreateDialogIndirectParamAorW( HINSTANCE hInst
,
930 HWND owner
, DLGPROC dlgProc
,
932 { FIXME("assume WIN_PROC_32W\n");
933 return DIALOG_CreateIndirect( hInst
, dlgTemplate
, TRUE
, owner
,
934 (DLGPROC16
)dlgProc
, param
, WIN_PROC_32W
);
937 /***********************************************************************
938 * CreateDialogIndirectParamW (USER32.72)
940 HWND WINAPI
CreateDialogIndirectParamW( HINSTANCE hInst
,
942 HWND owner
, DLGPROC dlgProc
,
945 return DIALOG_CreateIndirect( hInst
, dlgTemplate
, TRUE
, owner
,
946 (DLGPROC16
)dlgProc
, param
, WIN_PROC_32W
);
950 /***********************************************************************
953 INT
DIALOG_DoDialogBox( HWND hwnd
, HWND owner
)
956 DIALOGINFO
* dlgInfo
;
960 /* Owner must be a top-level window */
961 owner
= WIN_GetTopParent( owner
);
962 if (!(wndPtr
= WIN_FindWndPtr( hwnd
))) return -1;
963 dlgInfo
= (DIALOGINFO
*)wndPtr
->wExtra
;
965 if (!dlgInfo
->flags
& DF_END
) /* was EndDialog called in WM_INITDIALOG ? */
967 EnableWindow( owner
, FALSE
);
968 ShowWindow( hwnd
, SW_SHOW
);
969 while (MSG_InternalGetMessage(QMSG_WIN32A
, &msg
, hwnd
, owner
, MSGF_DIALOGBOX
,
970 PM_REMOVE
, !(wndPtr
->dwStyle
& DS_NOIDLEMSG
), NULL
))
972 if (!IsDialogMessageA( hwnd
, &msg
))
974 TranslateMessage( &msg
);
975 DispatchMessageA( &msg
);
977 if (dlgInfo
->flags
& DF_END
) break;
979 EnableWindow( owner
, TRUE
);
981 retval
= dlgInfo
->idResult
;
982 WIN_ReleaseWndPtr(wndPtr
);
983 DestroyWindow( hwnd
);
988 /***********************************************************************
989 * DialogBox16 (USER.87)
991 INT16 WINAPI
DialogBox16( HINSTANCE16 hInst
, SEGPTR dlgTemplate
,
992 HWND16 owner
, DLGPROC16 dlgProc
)
994 return DialogBoxParam16( hInst
, dlgTemplate
, owner
, dlgProc
, 0 );
998 /***********************************************************************
999 * DialogBoxParam16 (USER.239)
1001 INT16 WINAPI
DialogBoxParam16( HINSTANCE16 hInst
, SEGPTR
template,
1002 HWND16 owner
, DLGPROC16 dlgProc
, LPARAM param
)
1004 HWND16 hwnd
= CreateDialogParam16( hInst
, template, owner
, dlgProc
, param
);
1005 if (hwnd
) return (INT16
)DIALOG_DoDialogBox( hwnd
, owner
);
1010 /***********************************************************************
1011 * DialogBoxParamA (USER32.139)
1013 INT WINAPI
DialogBoxParamA( HINSTANCE hInst
, LPCSTR name
,
1014 HWND owner
, DLGPROC dlgProc
, LPARAM param
)
1016 HWND hwnd
= CreateDialogParamA( hInst
, name
, owner
, dlgProc
, param
);
1017 if (hwnd
) return DIALOG_DoDialogBox( hwnd
, owner
);
1022 /***********************************************************************
1023 * DialogBoxParamW (USER32.140)
1025 INT WINAPI
DialogBoxParamW( HINSTANCE hInst
, LPCWSTR name
,
1026 HWND owner
, DLGPROC dlgProc
, LPARAM param
)
1028 HWND hwnd
= CreateDialogParamW( hInst
, name
, owner
, dlgProc
, param
);
1029 if (hwnd
) return DIALOG_DoDialogBox( hwnd
, owner
);
1034 /***********************************************************************
1035 * DialogBoxIndirect16 (USER.218)
1037 INT16 WINAPI
DialogBoxIndirect16( HINSTANCE16 hInst
, HANDLE16 dlgTemplate
,
1038 HWND16 owner
, DLGPROC16 dlgProc
)
1040 return DialogBoxIndirectParam16( hInst
, dlgTemplate
, owner
, dlgProc
, 0 );
1044 /***********************************************************************
1045 * DialogBoxIndirectParam16 (USER.240)
1047 INT16 WINAPI
DialogBoxIndirectParam16( HINSTANCE16 hInst
, HANDLE16 dlgTemplate
,
1048 HWND16 owner
, DLGPROC16 dlgProc
,
1054 if (!(ptr
= GlobalLock16( dlgTemplate
))) return -1;
1055 hwnd
= CreateDialogIndirectParam16( hInst
, ptr
, owner
, dlgProc
, param
);
1056 GlobalUnlock16( dlgTemplate
);
1057 if (hwnd
) return (INT16
)DIALOG_DoDialogBox( hwnd
, owner
);
1062 /***********************************************************************
1063 * DialogBoxIndirectParamA (USER32.136)
1065 INT WINAPI
DialogBoxIndirectParamA(HINSTANCE hInstance
, LPCVOID
template,
1066 HWND owner
, DLGPROC dlgProc
,
1069 HWND hwnd
= CreateDialogIndirectParamA( hInstance
, template,
1070 owner
, dlgProc
, param
);
1071 if (hwnd
) return DIALOG_DoDialogBox( hwnd
, owner
);
1076 /***********************************************************************
1077 * DialogBoxIndirectParamW (USER32.138)
1079 INT WINAPI
DialogBoxIndirectParamW(HINSTANCE hInstance
, LPCVOID
template,
1080 HWND owner
, DLGPROC dlgProc
,
1083 HWND hwnd
= CreateDialogIndirectParamW( hInstance
, template,
1084 owner
, dlgProc
, param
);
1085 if (hwnd
) return DIALOG_DoDialogBox( hwnd
, owner
);
1089 /***********************************************************************
1090 * DialogBoxIndirectParamAorW (USER32.138)
1092 INT WINAPI
DialogBoxIndirectParamAorW(HINSTANCE hInstance
, LPCVOID
template,
1093 HWND owner
, DLGPROC dlgProc
,
1094 LPARAM param
, DWORD x
)
1097 FIXME("0x%08x %p 0x%08x %p 0x%08lx 0x%08lx\n",
1098 hInstance
, template, owner
, dlgProc
, param
, x
);
1099 hwnd
= CreateDialogIndirectParamW( hInstance
, template,
1100 owner
, dlgProc
, param
);
1101 if (hwnd
) return DIALOG_DoDialogBox( hwnd
, owner
);
1105 /***********************************************************************
1106 * EndDialog16 (USER.88)
1108 BOOL16 WINAPI
EndDialog16( HWND16 hwnd
, INT16 retval
)
1110 return EndDialog( hwnd
, retval
);
1114 /***********************************************************************
1115 * EndDialog (USER32.173)
1117 BOOL WINAPI
EndDialog( HWND hwnd
, INT retval
)
1119 WND
* wndPtr
= WIN_FindWndPtr( hwnd
);
1120 DIALOGINFO
* dlgInfo
;
1123 TRACE("%04x %d\n", hwnd
, retval
);
1127 ERR("got invalid window handle (%04x); buggy app !?\n", hwnd
);
1131 if ((dlgInfo
= (DIALOGINFO
*)wndPtr
->wExtra
))
1133 dlgInfo
->idResult
= retval
;
1134 dlgInfo
->flags
|= DF_END
;
1138 hOwner
= WIN_GetTopParent( wndPtr
->owner
->hwndSelf
);
1140 /* Enable the owner first */
1141 if (hOwner
&& !IsWindowEnabled(hOwner
))
1142 EnableWindow( hOwner
, TRUE
);
1144 /* Windows sets the focus to the dialog itself in EndDialog */
1146 if (IsChild(hwnd
, GetFocus()))
1147 SetFocus(wndPtr
->hwndSelf
);
1149 /* Don't have to send a ShowWindow(SW_HIDE), just do
1150 SetWindowPos with SWP_HIDEWINDOW as done in Windows */
1152 SetWindowPos(hwnd
, (HWND
)0, 0, 0, 0, 0, SWP_NOMOVE
| SWP_NOSIZE
1153 | SWP_NOZORDER
| SWP_NOACTIVATE
| SWP_HIDEWINDOW
);
1155 WIN_ReleaseWndPtr(wndPtr
);
1161 /***********************************************************************
1162 * DIALOG_IsAccelerator
1164 static BOOL
DIALOG_IsAccelerator( HWND hwnd
, HWND hwndDlg
, WPARAM vKey
)
1166 HWND hwndControl
= hwnd
;
1169 BOOL RetVal
= FALSE
;
1174 wndPtr
= WIN_FindWndPtr( hwndControl
);
1175 if ( (wndPtr
!= NULL
) &&
1176 ((wndPtr
->dwStyle
& (WS_VISIBLE
| WS_DISABLED
)) == WS_VISIBLE
) )
1178 dlgCode
= SendMessageA( hwndControl
, WM_GETDLGCODE
, 0, 0 );
1179 if ( (dlgCode
& (DLGC_BUTTON
| DLGC_STATIC
)) &&
1180 (wndPtr
->text
!=NULL
))
1182 /* find the accelerator key */
1183 LPSTR p
= wndPtr
->text
- 2;
1186 p
= strchr( p
+ 2, '&' );
1188 while (p
!= NULL
&& p
[1] == '&');
1190 /* and check if it's the one we're looking for */
1191 if (p
!= NULL
&& toupper( p
[1] ) == toupper( vKey
) )
1193 if ((dlgCode
& DLGC_STATIC
) ||
1194 (wndPtr
->dwStyle
& 0x0f) == BS_GROUPBOX
)
1196 /* set focus to the control */
1197 SendMessageA( hwndDlg
, WM_NEXTDLGCTL
,
1199 /* and bump it on to next */
1200 SendMessageA( hwndDlg
, WM_NEXTDLGCTL
, 0, 0);
1202 else if (dlgCode
& DLGC_BUTTON
)
1204 /* send BM_CLICK message to the control */
1205 SendMessageA( hwndControl
, BM_CLICK
, 0, 0 );
1209 WIN_ReleaseWndPtr(wndPtr
);
1213 hwndNext
= GetWindow( hwndControl
, GW_CHILD
);
1219 WIN_ReleaseWndPtr(wndPtr
);
1222 hwndNext
= GetWindow( hwndControl
, GW_HWNDNEXT
);
1224 while (!hwndNext
&& hwndControl
)
1226 hwndControl
= GetParent( hwndControl
);
1227 if (hwndControl
== hwndDlg
)
1229 if(hwnd
==hwndDlg
){ /* prevent endless loop */
1233 hwndNext
= GetWindow( hwndDlg
, GW_CHILD
);
1237 hwndNext
= GetWindow( hwndControl
, GW_HWNDNEXT
);
1240 hwndControl
= hwndNext
;
1242 while (hwndControl
&& (hwndControl
!= hwnd
));
1247 /***********************************************************************
1248 * DIALOG_FindMsgDestination
1250 * The messages that IsDialogMessage send may not go to the dialog
1251 * calling IsDialogMessage if that dialog is a child, and it has the
1252 * DS_CONTROL style set.
1253 * We propagate up until we hit a that does not have DS_CONTROL, or
1254 * whose parent is not a dialog.
1256 * This is undocumented behaviour.
1258 static HWND
DIALOG_FindMsgDestination( HWND hwndDlg
)
1260 while (GetWindowLongA(hwndDlg
, GWL_STYLE
) & DS_CONTROL
)
1263 HWND hParent
= GetParent(hwndDlg
);
1264 if (!hParent
) break;
1266 pParent
= WIN_FindWndPtr(hParent
);
1267 if (!pParent
) break;
1269 if (!(pParent
->flags
& WIN_ISDIALOG
))
1271 WIN_ReleaseWndPtr(pParent
);
1274 WIN_ReleaseWndPtr(pParent
);
1282 /***********************************************************************
1283 * DIALOG_IsDialogMessage
1285 static BOOL
DIALOG_IsDialogMessage( HWND hwnd
, HWND hwndDlg
,
1286 UINT message
, WPARAM wParam
,
1287 LPARAM lParam
, BOOL
*translate
,
1288 BOOL
*dispatch
, INT dlgCode
)
1290 *translate
= *dispatch
= FALSE
;
1292 if (message
== WM_PAINT
)
1294 /* Apparently, we have to handle this one as well */
1299 /* Only the key messages get special processing */
1300 if ((message
!= WM_KEYDOWN
) &&
1301 (message
!= WM_SYSCHAR
) &&
1302 (message
!= WM_CHAR
))
1305 if (dlgCode
& DLGC_WANTMESSAGE
)
1307 *translate
= *dispatch
= TRUE
;
1311 hwndDlg
= DIALOG_FindMsgDestination(hwndDlg
);
1319 if (!(dlgCode
& DLGC_WANTTAB
))
1321 SendMessageA( hwndDlg
, WM_NEXTDLGCTL
,
1322 (GetKeyState(VK_SHIFT
) & 0x8000), 0 );
1331 if (!(dlgCode
& DLGC_WANTARROWS
))
1333 BOOL fPrevious
= (wParam
== VK_LEFT
|| wParam
== VK_UP
);
1335 GetNextDlgGroupItem (hwndDlg
, GetFocus(), fPrevious
);
1336 SendMessageA( hwndDlg
, WM_NEXTDLGCTL
, hwndNext
, 1 );
1342 SendMessageA( hwndDlg
, WM_COMMAND
, IDCANCEL
,
1343 (LPARAM
)GetDlgItem( hwndDlg
, IDCANCEL
) );
1348 DWORD dw
= SendMessage16( hwndDlg
, DM_GETDEFID
, 0, 0 );
1349 if (HIWORD(dw
) == DC_HASDEFID
)
1351 SendMessageA( hwndDlg
, WM_COMMAND
,
1352 MAKEWPARAM( LOWORD(dw
), BN_CLICKED
),
1353 (LPARAM
)GetDlgItem(hwndDlg
, LOWORD(dw
)));
1357 SendMessageA( hwndDlg
, WM_COMMAND
, IDOK
,
1358 (LPARAM
)GetDlgItem( hwndDlg
, IDOK
) );
1365 break; /* case WM_KEYDOWN */
1368 if (dlgCode
& DLGC_WANTCHARS
) break;
1372 if (DIALOG_IsAccelerator( hwnd
, hwndDlg
, wParam
))
1374 /* don't translate or dispatch */
1380 /* If we get here, the message has not been treated specially */
1381 /* and can be sent to its destination window. */
1387 /***********************************************************************
1388 * IsDialogMessage16 (USER.90)
1390 BOOL16 WINAPI
WIN16_IsDialogMessage16( HWND16 hwndDlg
, SEGPTR msg16
)
1392 LPMSG16 msg
= PTR_SEG_TO_LIN(msg16
);
1393 BOOL ret
, translate
, dispatch
;
1396 if ((hwndDlg
!= msg
->hwnd
) && !IsChild16( hwndDlg
, msg
->hwnd
))
1399 if ((msg
->message
== WM_KEYDOWN
) ||
1400 (msg
->message
== WM_SYSCHAR
) ||
1401 (msg
->message
== WM_CHAR
))
1403 dlgCode
= SendMessage16( msg
->hwnd
, WM_GETDLGCODE
, 0, (LPARAM
)msg16
);
1405 ret
= DIALOG_IsDialogMessage( msg
->hwnd
, hwndDlg
, msg
->message
,
1406 msg
->wParam
, msg
->lParam
,
1407 &translate
, &dispatch
, dlgCode
);
1408 if (translate
) TranslateMessage16( msg
);
1409 if (dispatch
) DispatchMessage16( msg
);
1414 BOOL16 WINAPI
IsDialogMessage16( HWND16 hwndDlg
, LPMSG16 msg
)
1416 LPMSG16 msg16
= SEGPTR_NEW(MSG16
);
1420 ret
= WIN16_IsDialogMessage16( hwndDlg
, SEGPTR_GET(msg16
) );
1425 /***********************************************************************
1426 * IsDialogMessageA (USER32.342)
1428 BOOL WINAPI
IsDialogMessageA( HWND hwndDlg
, LPMSG msg
)
1430 BOOL ret
, translate
, dispatch
;
1433 if ((hwndDlg
!= msg
->hwnd
) && !IsChild( hwndDlg
, msg
->hwnd
))
1436 if ((msg
->message
== WM_KEYDOWN
) ||
1437 (msg
->message
== WM_SYSCHAR
) ||
1438 (msg
->message
== WM_CHAR
))
1440 dlgCode
= SendMessageA( msg
->hwnd
, WM_GETDLGCODE
, 0, (LPARAM
)msg
);
1442 ret
= DIALOG_IsDialogMessage( msg
->hwnd
, hwndDlg
, msg
->message
,
1443 msg
->wParam
, msg
->lParam
,
1444 &translate
, &dispatch
, dlgCode
);
1445 if (translate
) TranslateMessage( msg
);
1446 if (dispatch
) DispatchMessageA( msg
);
1451 /***********************************************************************
1452 * IsDialogMessageW (USER32.343)
1454 BOOL WINAPI
IsDialogMessageW( HWND hwndDlg
, LPMSG msg
)
1456 BOOL ret
, translate
, dispatch
;
1459 if ((hwndDlg
!= msg
->hwnd
) && !IsChild( hwndDlg
, msg
->hwnd
))
1462 if ((msg
->message
== WM_KEYDOWN
) ||
1463 (msg
->message
== WM_SYSCHAR
) ||
1464 (msg
->message
== WM_CHAR
))
1466 dlgCode
= SendMessageW( msg
->hwnd
, WM_GETDLGCODE
, 0, (LPARAM
)msg
);
1468 ret
= DIALOG_IsDialogMessage( msg
->hwnd
, hwndDlg
, msg
->message
,
1469 msg
->wParam
, msg
->lParam
,
1470 &translate
, &dispatch
, dlgCode
);
1471 if (translate
) TranslateMessage( msg
);
1472 if (dispatch
) DispatchMessageW( msg
);
1477 /***********************************************************************
1478 * GetDlgCtrlID16 (USER.277)
1480 INT16 WINAPI
GetDlgCtrlID16( HWND16 hwnd
)
1482 WND
*wndPtr
= WIN_FindWndPtr(hwnd
);
1485 if (!wndPtr
) return 0;
1487 retvalue
= wndPtr
->wIDmenu
;
1488 WIN_ReleaseWndPtr(wndPtr
);
1493 /***********************************************************************
1494 * GetDlgCtrlID (USER32.234)
1496 INT WINAPI
GetDlgCtrlID( HWND hwnd
)
1499 WND
*wndPtr
= WIN_FindWndPtr(hwnd
);
1500 if (!wndPtr
) return 0;
1501 retvalue
= wndPtr
->wIDmenu
;
1502 WIN_ReleaseWndPtr(wndPtr
);
1507 /***********************************************************************
1508 * GetDlgItem16 (USER.91)
1510 HWND16 WINAPI
GetDlgItem16( HWND16 hwndDlg
, INT16 id
)
1514 if (!(pWnd
= WIN_FindWndPtr( hwndDlg
))) return 0;
1515 for (WIN_UpdateWndPtr(&pWnd
,pWnd
->child
); pWnd
; WIN_UpdateWndPtr(&pWnd
,pWnd
->next
))
1516 if (pWnd
->wIDmenu
== (UINT16
)id
)
1518 HWND16 retvalue
= pWnd
->hwndSelf
;
1519 WIN_ReleaseWndPtr(pWnd
);
1526 /***********************************************************************
1527 * GetDlgItem (USER32.235)
1529 HWND WINAPI
GetDlgItem( HWND hwndDlg
, INT id
)
1533 if (!(pWnd
= WIN_FindWndPtr( hwndDlg
))) return 0;
1534 for (WIN_UpdateWndPtr(&pWnd
,pWnd
->child
); pWnd
;WIN_UpdateWndPtr(&pWnd
,pWnd
->next
))
1535 if (pWnd
->wIDmenu
== (UINT16
)id
)
1537 HWND retvalue
= pWnd
->hwndSelf
;
1538 WIN_ReleaseWndPtr(pWnd
);
1545 /*******************************************************************
1546 * SendDlgItemMessage16 (USER.101)
1548 LRESULT WINAPI
SendDlgItemMessage16( HWND16 hwnd
, INT16 id
, UINT16 msg
,
1549 WPARAM16 wParam
, LPARAM lParam
)
1551 HWND16 hwndCtrl
= GetDlgItem16( hwnd
, id
);
1552 if (hwndCtrl
) return SendMessage16( hwndCtrl
, msg
, wParam
, lParam
);
1557 /*******************************************************************
1558 * SendDlgItemMessageA (USER32.452)
1560 LRESULT WINAPI
SendDlgItemMessageA( HWND hwnd
, INT id
, UINT msg
,
1561 WPARAM wParam
, LPARAM lParam
)
1563 HWND hwndCtrl
= GetDlgItem( hwnd
, id
);
1564 if (hwndCtrl
) return SendMessageA( hwndCtrl
, msg
, wParam
, lParam
);
1569 /*******************************************************************
1570 * SendDlgItemMessageW (USER32.453)
1572 LRESULT WINAPI
SendDlgItemMessageW( HWND hwnd
, INT id
, UINT msg
,
1573 WPARAM wParam
, LPARAM lParam
)
1575 HWND hwndCtrl
= GetDlgItem( hwnd
, id
);
1576 if (hwndCtrl
) return SendMessageW( hwndCtrl
, msg
, wParam
, lParam
);
1581 /*******************************************************************
1582 * SetDlgItemText16 (USER.92)
1584 void WINAPI
SetDlgItemText16( HWND16 hwnd
, INT16 id
, SEGPTR lpString
)
1586 SendDlgItemMessage16( hwnd
, id
, WM_SETTEXT
, 0, (LPARAM
)lpString
);
1590 /*******************************************************************
1591 * SetDlgItemTextA (USER32.478)
1593 BOOL WINAPI
SetDlgItemTextA( HWND hwnd
, INT id
, LPCSTR lpString
)
1595 return SendDlgItemMessageA( hwnd
, id
, WM_SETTEXT
, 0, (LPARAM
)lpString
);
1599 /*******************************************************************
1600 * SetDlgItemTextW (USER32.479)
1602 BOOL WINAPI
SetDlgItemTextW( HWND hwnd
, INT id
, LPCWSTR lpString
)
1604 return SendDlgItemMessageW( hwnd
, id
, WM_SETTEXT
, 0, (LPARAM
)lpString
);
1608 /***********************************************************************
1609 * GetDlgItemText16 (USER.93)
1611 INT16 WINAPI
GetDlgItemText16( HWND16 hwnd
, INT16 id
, SEGPTR str
, UINT16 len
)
1613 return (INT16
)SendDlgItemMessage16( hwnd
, id
, WM_GETTEXT
,
1618 /***********************************************************************
1619 * GetDlgItemTextA (USER32.237)
1621 INT WINAPI
GetDlgItemTextA( HWND hwnd
, INT id
, LPSTR str
, UINT len
)
1623 return (INT
)SendDlgItemMessageA( hwnd
, id
, WM_GETTEXT
,
1628 /***********************************************************************
1629 * GetDlgItemTextW (USER32.238)
1631 INT WINAPI
GetDlgItemTextW( HWND hwnd
, INT id
, LPWSTR str
, UINT len
)
1633 return (INT
)SendDlgItemMessageW( hwnd
, id
, WM_GETTEXT
,
1638 /*******************************************************************
1639 * SetDlgItemInt16 (USER.94)
1641 void WINAPI
SetDlgItemInt16( HWND16 hwnd
, INT16 id
, UINT16 value
, BOOL16 fSigned
)
1643 SetDlgItemInt( hwnd
, (UINT
)(UINT16
)id
, value
, fSigned
);
1647 /*******************************************************************
1648 * SetDlgItemInt (USER32.477)
1650 BOOL WINAPI
SetDlgItemInt( HWND hwnd
, INT id
, UINT value
,
1655 if (fSigned
) sprintf( str
, "%d", (INT
)value
);
1656 else sprintf( str
, "%u", value
);
1657 SendDlgItemMessageA( hwnd
, id
, WM_SETTEXT
, 0, (LPARAM
)str
);
1662 /***********************************************************************
1663 * GetDlgItemInt16 (USER.95)
1665 UINT16 WINAPI
GetDlgItemInt16( HWND16 hwnd
, INT16 id
, BOOL16
*translated
,
1671 if (translated
) *translated
= FALSE
;
1672 result
= GetDlgItemInt( hwnd
, (UINT
)(UINT16
)id
, &ok
, fSigned
);
1676 if (((INT
)result
< -32767) || ((INT
)result
> 32767)) return 0;
1680 if (result
> 65535) return 0;
1682 if (translated
) *translated
= TRUE
;
1683 return (UINT16
)result
;
1687 /***********************************************************************
1688 * GetDlgItemInt (USER32.236)
1690 UINT WINAPI
GetDlgItemInt( HWND hwnd
, INT id
, BOOL
*translated
,
1697 if (translated
) *translated
= FALSE
;
1698 if (!SendDlgItemMessageA(hwnd
, id
, WM_GETTEXT
, sizeof(str
), (LPARAM
)str
))
1702 result
= strtol( str
, &endptr
, 10 );
1703 if (!endptr
|| (endptr
== str
)) /* Conversion was unsuccessful */
1705 if (((result
== LONG_MIN
) || (result
== LONG_MAX
)) && (errno
==ERANGE
))
1710 result
= strtoul( str
, &endptr
, 10 );
1711 if (!endptr
|| (endptr
== str
)) /* Conversion was unsuccessful */
1713 if ((result
== ULONG_MAX
) && (errno
== ERANGE
)) return 0;
1715 if (translated
) *translated
= TRUE
;
1716 return (UINT
)result
;
1720 /***********************************************************************
1721 * CheckDlgButton16 (USER.97)
1723 BOOL16 WINAPI
CheckDlgButton16( HWND16 hwnd
, INT16 id
, UINT16 check
)
1725 SendDlgItemMessageA( hwnd
, id
, BM_SETCHECK
, check
, 0 );
1730 /***********************************************************************
1731 * CheckDlgButton (USER32.45)
1733 BOOL WINAPI
CheckDlgButton( HWND hwnd
, INT id
, UINT check
)
1735 SendDlgItemMessageA( hwnd
, id
, BM_SETCHECK
, check
, 0 );
1740 /***********************************************************************
1741 * IsDlgButtonChecked16 (USER.98)
1743 UINT16 WINAPI
IsDlgButtonChecked16( HWND16 hwnd
, UINT16 id
)
1745 return (UINT16
)SendDlgItemMessageA( hwnd
, id
, BM_GETCHECK
, 0, 0 );
1749 /***********************************************************************
1750 * IsDlgButtonChecked (USER32.344)
1752 UINT WINAPI
IsDlgButtonChecked( HWND hwnd
, UINT id
)
1754 return (UINT
)SendDlgItemMessageA( hwnd
, id
, BM_GETCHECK
, 0, 0 );
1758 /***********************************************************************
1759 * CheckRadioButton16 (USER.96)
1761 BOOL16 WINAPI
CheckRadioButton16( HWND16 hwndDlg
, UINT16 firstID
,
1762 UINT16 lastID
, UINT16 checkID
)
1764 return CheckRadioButton( hwndDlg
, firstID
, lastID
, checkID
);
1768 /***********************************************************************
1771 * Callback function used to check/uncheck radio buttons that fall
1772 * within a specific range of IDs.
1774 static BOOL CALLBACK
CheckRB(HWND hwndChild
, LPARAM lParam
)
1776 LONG lChildID
= GetWindowLongA(hwndChild
, GWL_ID
);
1777 RADIOGROUP
*lpRadioGroup
= (RADIOGROUP
*) lParam
;
1779 if ((lChildID
>= lpRadioGroup
->firstID
) &&
1780 (lChildID
<= lpRadioGroup
->lastID
))
1782 if (lChildID
== lpRadioGroup
->checkID
)
1784 SendMessageA(hwndChild
, BM_SETCHECK
, BST_CHECKED
, 0);
1788 SendMessageA(hwndChild
, BM_SETCHECK
, BST_UNCHECKED
, 0);
1796 /***********************************************************************
1797 * CheckRadioButton (USER32.48)
1799 BOOL WINAPI
CheckRadioButton( HWND hwndDlg
, UINT firstID
,
1800 UINT lastID
, UINT checkID
)
1802 RADIOGROUP radioGroup
;
1804 /* perform bounds checking for a radio button group */
1805 radioGroup
.firstID
= min(min(firstID
, lastID
), checkID
);
1806 radioGroup
.lastID
= max(max(firstID
, lastID
), checkID
);
1807 radioGroup
.checkID
= checkID
;
1809 return EnumChildWindows(hwndDlg
, (WNDENUMPROC
)CheckRB
,
1810 (LPARAM
)&radioGroup
);
1814 /***********************************************************************
1815 * GetDialogBaseUnits (USER.243) (USER32.233)
1817 DWORD WINAPI
GetDialogBaseUnits(void)
1819 return MAKELONG( xBaseUnit
, yBaseUnit
);
1823 /***********************************************************************
1824 * MapDialogRect16 (USER.103)
1826 void WINAPI
MapDialogRect16( HWND16 hwnd
, LPRECT16 rect
)
1828 DIALOGINFO
* dlgInfo
;
1829 WND
* wndPtr
= WIN_FindWndPtr( hwnd
);
1830 if (!wndPtr
) return;
1831 dlgInfo
= (DIALOGINFO
*)wndPtr
->wExtra
;
1832 rect
->left
= MulDiv(rect
->left
, dlgInfo
->xBaseUnit
, 4);
1833 rect
->right
= MulDiv(rect
->right
, dlgInfo
->xBaseUnit
, 4);
1834 rect
->top
= MulDiv(rect
->top
, dlgInfo
->yBaseUnit
, 8);
1835 rect
->bottom
= MulDiv(rect
->bottom
, dlgInfo
->yBaseUnit
, 8);
1836 WIN_ReleaseWndPtr(wndPtr
);
1840 /***********************************************************************
1841 * MapDialogRect (USER32.382)
1843 BOOL WINAPI
MapDialogRect( HWND hwnd
, LPRECT rect
)
1845 DIALOGINFO
* dlgInfo
;
1846 WND
* wndPtr
= WIN_FindWndPtr( hwnd
);
1847 if (!wndPtr
) return FALSE
;
1848 dlgInfo
= (DIALOGINFO
*)wndPtr
->wExtra
;
1849 rect
->left
= MulDiv(rect
->left
, dlgInfo
->xBaseUnit
, 4);
1850 rect
->right
= MulDiv(rect
->right
, dlgInfo
->xBaseUnit
, 4);
1851 rect
->top
= MulDiv(rect
->top
, dlgInfo
->yBaseUnit
, 8);
1852 rect
->bottom
= MulDiv(rect
->bottom
, dlgInfo
->yBaseUnit
, 8);
1853 WIN_ReleaseWndPtr(wndPtr
);
1858 /***********************************************************************
1859 * GetNextDlgGroupItem16 (USER.227)
1861 HWND16 WINAPI
GetNextDlgGroupItem16( HWND16 hwndDlg
, HWND16 hwndCtrl
,
1864 return (HWND16
)GetNextDlgGroupItem( hwndDlg
, hwndCtrl
, fPrevious
);
1868 /***********************************************************************
1869 * GetNextDlgGroupItem (USER32.275)
1871 HWND WINAPI
GetNextDlgGroupItem( HWND hwndDlg
, HWND hwndCtrl
,
1882 /* if the hwndCtrl is the child of the control in the hwndDlg then the hwndDlg has to be the parent of the hwndCtrl */
1883 if(GetParent(hwndCtrl
) != hwndDlg
&& GetParent(GetParent(hwndCtrl
)) == hwndDlg
)
1884 hwndDlg
= GetParent(hwndCtrl
);
1887 if (!(pWndDlg
= WIN_FindWndPtr( hwndDlg
))) return 0;
1890 if (!(pWndCtrl
= WIN_FindWndPtr( hwndCtrl
)))
1895 /* Make sure hwndCtrl is a top-level child */
1896 while ((pWndCtrl
->dwStyle
& WS_CHILD
) && (pWndCtrl
->parent
!= pWndDlg
))
1897 WIN_UpdateWndPtr(&pWndCtrl
,pWndCtrl
->parent
);
1898 if (pWndCtrl
->parent
!= pWndDlg
)
1906 /* No ctrl specified -> start from the beginning */
1907 if (!(pWndCtrl
= WIN_LockWndPtr(pWndDlg
->child
)))
1913 while (pWndCtrl
->next
) WIN_UpdateWndPtr(&pWndCtrl
,pWndCtrl
->next
);
1916 pWndLast
= WIN_LockWndPtr(pWndCtrl
);
1917 pWnd
= WIN_LockWndPtr(pWndCtrl
->next
);
1921 if (!pWnd
|| (pWnd
->dwStyle
& WS_GROUP
))
1923 /* Wrap-around to the beginning of the group */
1926 WIN_UpdateWndPtr( &pWnd
, pWndDlg
->child
);
1927 for ( pWndTemp
= WIN_LockWndPtr( pWnd
);
1929 WIN_UpdateWndPtr( &pWndTemp
, pWndTemp
->next
) )
1931 if (pWndTemp
->dwStyle
& WS_GROUP
) WIN_UpdateWndPtr( &pWnd
, pWndTemp
);
1932 if (pWndTemp
== pWndCtrl
) break;
1934 WIN_ReleaseWndPtr( pWndTemp
);
1936 if (pWnd
== pWndCtrl
) break;
1937 if ((pWnd
->dwStyle
& WS_VISIBLE
) && !(pWnd
->dwStyle
& WS_DISABLED
))
1939 WIN_UpdateWndPtr(&pWndLast
,pWnd
);
1940 if (!fPrevious
) break;
1942 WIN_UpdateWndPtr(&pWnd
,pWnd
->next
);
1944 retvalue
= pWndLast
->hwndSelf
;
1946 WIN_ReleaseWndPtr(pWndLast
);
1947 WIN_ReleaseWndPtr(pWnd
);
1949 WIN_ReleaseWndPtr(pWndCtrl
);
1950 WIN_ReleaseWndPtr(pWndDlg
);
1956 /***********************************************************************
1957 * GetNextDlgTabItem16 (USER.228)
1959 HWND16 WINAPI
GetNextDlgTabItem16( HWND16 hwndDlg
, HWND16 hwndCtrl
,
1962 return (HWND16
)GetNextDlgTabItem( hwndDlg
, hwndCtrl
, fPrevious
);
1965 /***********************************************************************
1966 * DIALOG_GetNextTabItem
1968 * Helper for GetNextDlgTabItem
1970 static HWND
DIALOG_GetNextTabItem( HWND hwndMain
, HWND hwndDlg
, HWND hwndCtrl
, BOOL fPrevious
)
1974 UINT wndSearch
= fPrevious
? GW_HWNDPREV
: GW_HWNDNEXT
;
1976 HWND hChildFirst
= 0;
1980 hChildFirst
= GetWindow(hwndDlg
,GW_CHILD
);
1981 if(fPrevious
) hChildFirst
= GetWindow(hChildFirst
,GW_HWNDLAST
);
1985 HWND hParent
= GetParent(hwndCtrl
);
1986 BOOL bValid
= FALSE
;
1989 if(hParent
== hwndMain
)
1994 hParent
= GetParent(hParent
);
1998 hChildFirst
= GetWindow(hwndCtrl
,wndSearch
);
2001 if(GetParent(hwndCtrl
) != hwndMain
)
2002 hChildFirst
= GetWindow(GetParent(hwndCtrl
),wndSearch
);
2006 hChildFirst
= GetWindow(hwndCtrl
,GW_HWNDLAST
);
2008 hChildFirst
= GetWindow(hwndCtrl
,GW_HWNDFIRST
);
2018 dsStyle
= GetWindowLongA(hChildFirst
,GWL_STYLE
);
2019 exStyle
= GetWindowLongA(hChildFirst
,GWL_EXSTYLE
);
2020 if( (dsStyle
& DS_CONTROL
|| exStyle
& WS_EX_CONTROLPARENT
) && (dsStyle
& WS_VISIBLE
) && !(dsStyle
& WS_DISABLED
))
2025 else if( (dsStyle
& WS_TABSTOP
) && (dsStyle
& WS_VISIBLE
) && !(dsStyle
& WS_DISABLED
))
2027 hChildFirst
= GetWindow(hChildFirst
,wndSearch
);
2032 retWnd
= DIALOG_GetNextTabItem(hwndMain
,hChildFirst
,(HWND
)NULL
,fPrevious
);
2034 retWnd
= hChildFirst
;
2037 hChildFirst
= GetWindow(hChildFirst
,wndSearch
);
2039 if(!retWnd
&& hwndCtrl
)
2041 HWND hParent
= GetParent(hwndCtrl
);
2044 if(hParent
== hwndMain
) break;
2045 retWnd
= DIALOG_GetNextTabItem(hwndMain
,GetParent(hParent
),hParent
,fPrevious
);
2047 hParent
= GetParent(hParent
);
2050 retWnd
= DIALOG_GetNextTabItem(hwndMain
,hwndMain
,(HWND
)NULL
,fPrevious
);
2055 /***********************************************************************
2056 * GetNextDlgTabItem (USER32.276)
2058 HWND WINAPI
GetNextDlgTabItem( HWND hwndDlg
, HWND hwndCtrl
,
2061 return DIALOG_GetNextTabItem(hwndDlg
,hwndDlg
,hwndCtrl
,fPrevious
);
2064 /**********************************************************************
2065 * DIALOG_DlgDirSelect
2067 * Helper function for DlgDirSelect*
2069 static BOOL
DIALOG_DlgDirSelect( HWND hwnd
, LPSTR str
, INT len
,
2070 INT id
, BOOL win32
, BOOL unicode
,
2076 HWND listbox
= GetDlgItem( hwnd
, id
);
2078 TRACE("%04x '%s' %d\n", hwnd
, str
, id
);
2079 if (!listbox
) return FALSE
;
2082 item
= SendMessageA(listbox
, combo
? CB_GETCURSEL
2083 : LB_GETCURSEL
, 0, 0 );
2084 if (item
== LB_ERR
) return FALSE
;
2085 size
= SendMessageA(listbox
, combo
? CB_GETLBTEXTLEN
2086 : LB_GETTEXTLEN
, 0, 0 );
2087 if (size
== LB_ERR
) return FALSE
;
2091 item
= SendMessageA(listbox
, combo
? CB_GETCURSEL16
2092 : LB_GETCURSEL16
, 0, 0 );
2093 if (item
== LB_ERR
) return FALSE
;
2094 size
= SendMessageA(listbox
, combo
? CB_GETLBTEXTLEN16
2095 : LB_GETTEXTLEN16
, 0, 0 );
2096 if (size
== LB_ERR
) return FALSE
;
2099 if (!(buffer
= SEGPTR_ALLOC( size
+1 ))) return FALSE
;
2102 SendMessageA( listbox
, combo
? CB_GETLBTEXT
: LB_GETTEXT
,
2103 item
, (LPARAM
)buffer
);
2105 SendMessage16( listbox
, combo
? CB_GETLBTEXT16
: LB_GETTEXT16
,
2106 item
, (LPARAM
)SEGPTR_GET(buffer
) );
2108 if ((ret
= (buffer
[0] == '['))) /* drive or directory */
2110 if (buffer
[1] == '-') /* drive */
2118 buffer
[strlen(buffer
)-1] = '\\';
2124 if (unicode
) lstrcpynAtoW( (LPWSTR
)str
, ptr
, len
);
2125 else lstrcpynA( str
, ptr
, len
);
2126 SEGPTR_FREE( buffer
);
2127 TRACE("Returning %d '%s'\n", ret
, str
);
2132 /**********************************************************************
2135 * Helper function for DlgDirList*
2137 static INT
DIALOG_DlgDirList( HWND hDlg
, LPSTR spec
, INT idLBox
,
2138 INT idStatic
, UINT attrib
, BOOL combo
)
2142 LPSTR orig_spec
= spec
;
2144 #define SENDMSG(msg,wparam,lparam) \
2145 ((attrib & DDL_POSTMSGS) ? PostMessageA( hwnd, msg, wparam, lparam ) \
2146 : SendMessageA( hwnd, msg, wparam, lparam ))
2148 TRACE("%04x '%s' %d %d %04x\n",
2149 hDlg
, spec
? spec
: "NULL", idLBox
, idStatic
, attrib
);
2151 if (spec
&& spec
[0] && (spec
[1] == ':'))
2153 drive
= toupper( spec
[0] ) - 'A';
2155 if (!DRIVE_SetCurrentDrive( drive
)) return FALSE
;
2157 else drive
= DRIVE_GetCurrentDrive();
2159 /* If the path exists and is a directory, chdir to it */
2160 if (!spec
|| !spec
[0] || DRIVE_Chdir( drive
, spec
)) spec
= "*.*";
2165 if ((p2
= strrchr( p
, '\\' ))) p
= p2
;
2166 if ((p2
= strrchr( p
, '/' ))) p
= p2
;
2171 if (!DRIVE_Chdir( drive
, spec
))
2173 *p
= sep
; /* Restore the original spec */
2180 TRACE("path=%c:\\%s mask=%s\n",
2181 'A' + drive
, DRIVE_GetDosCwd(drive
), spec
);
2183 if (idLBox
&& ((hwnd
= GetDlgItem( hDlg
, idLBox
)) != 0))
2185 SENDMSG( combo
? CB_RESETCONTENT
: LB_RESETCONTENT
, 0, 0 );
2186 if (attrib
& DDL_DIRECTORY
)
2188 if (!(attrib
& DDL_EXCLUSIVE
))
2190 if (SENDMSG( combo
? CB_DIR
: LB_DIR
,
2191 attrib
& ~(DDL_DIRECTORY
| DDL_DRIVES
),
2192 (LPARAM
)spec
) == LB_ERR
)
2195 if (SENDMSG( combo
? CB_DIR
: LB_DIR
,
2196 (attrib
& (DDL_DIRECTORY
| DDL_DRIVES
)) | DDL_EXCLUSIVE
,
2197 (LPARAM
)"*.*" ) == LB_ERR
)
2202 if (SENDMSG( combo
? CB_DIR
: LB_DIR
, attrib
,
2203 (LPARAM
)spec
) == LB_ERR
)
2208 if (idStatic
&& ((hwnd
= GetDlgItem( hDlg
, idStatic
)) != 0))
2211 int drive
= DRIVE_GetCurrentDrive();
2212 strcpy( temp
, "A:\\" );
2214 lstrcpynA( temp
+ 3, DRIVE_GetDosCwd(drive
), sizeof(temp
)-3 );
2216 /* Can't use PostMessage() here, because the string is on the stack */
2217 SetDlgItemTextA( hDlg
, idStatic
, temp
);
2220 if (orig_spec
&& (spec
!= orig_spec
))
2222 /* Update the original file spec */
2224 while ((*orig_spec
++ = *p
++));
2232 /**********************************************************************
2233 * DIALOG_DlgDirListW
2235 * Helper function for DlgDirList*W
2237 static INT
DIALOG_DlgDirListW( HWND hDlg
, LPWSTR spec
, INT idLBox
,
2238 INT idStatic
, UINT attrib
, BOOL combo
)
2242 LPSTR specA
= HEAP_strdupWtoA( GetProcessHeap(), 0, spec
);
2243 INT ret
= DIALOG_DlgDirList( hDlg
, specA
, idLBox
, idStatic
,
2245 lstrcpyAtoW( spec
, specA
);
2246 HeapFree( GetProcessHeap(), 0, specA
);
2249 return DIALOG_DlgDirList( hDlg
, NULL
, idLBox
, idStatic
, attrib
, combo
);
2253 /**********************************************************************
2254 * DlgDirSelect (USER.99)
2256 BOOL16 WINAPI
DlgDirSelect16( HWND16 hwnd
, LPSTR str
, INT16 id
)
2258 return DlgDirSelectEx16( hwnd
, str
, 128, id
);
2262 /**********************************************************************
2263 * DlgDirSelectComboBox (USER.194)
2265 BOOL16 WINAPI
DlgDirSelectComboBox16( HWND16 hwnd
, LPSTR str
, INT16 id
)
2267 return DlgDirSelectComboBoxEx16( hwnd
, str
, 128, id
);
2271 /**********************************************************************
2272 * DlgDirSelectEx16 (USER.422)
2274 BOOL16 WINAPI
DlgDirSelectEx16( HWND16 hwnd
, LPSTR str
, INT16 len
, INT16 id
)
2276 return DIALOG_DlgDirSelect( hwnd
, str
, len
, id
, FALSE
, FALSE
, FALSE
);
2280 /**********************************************************************
2281 * DlgDirSelectExA (USER32.149)
2283 BOOL WINAPI
DlgDirSelectExA( HWND hwnd
, LPSTR str
, INT len
, INT id
)
2285 return DIALOG_DlgDirSelect( hwnd
, str
, len
, id
, TRUE
, FALSE
, FALSE
);
2289 /**********************************************************************
2290 * DlgDirSelectExW (USER32.150)
2292 BOOL WINAPI
DlgDirSelectExW( HWND hwnd
, LPWSTR str
, INT len
, INT id
)
2294 return DIALOG_DlgDirSelect( hwnd
, (LPSTR
)str
, len
, id
, TRUE
, TRUE
, FALSE
);
2298 /**********************************************************************
2299 * DlgDirSelectComboBoxEx16 (USER.423)
2301 BOOL16 WINAPI
DlgDirSelectComboBoxEx16( HWND16 hwnd
, LPSTR str
, INT16 len
,
2304 return DIALOG_DlgDirSelect( hwnd
, str
, len
, id
, FALSE
, FALSE
, TRUE
);
2308 /**********************************************************************
2309 * DlgDirSelectComboBoxExA (USER32.147)
2311 BOOL WINAPI
DlgDirSelectComboBoxExA( HWND hwnd
, LPSTR str
, INT len
,
2314 return DIALOG_DlgDirSelect( hwnd
, str
, len
, id
, TRUE
, FALSE
, TRUE
);
2318 /**********************************************************************
2319 * DlgDirSelectComboBoxExW (USER32.148)
2321 BOOL WINAPI
DlgDirSelectComboBoxExW( HWND hwnd
, LPWSTR str
, INT len
,
2324 return DIALOG_DlgDirSelect( hwnd
, (LPSTR
)str
, len
, id
, TRUE
, TRUE
, TRUE
);
2328 /**********************************************************************
2329 * DlgDirList16 (USER.100)
2331 INT16 WINAPI
DlgDirList16( HWND16 hDlg
, LPSTR spec
, INT16 idLBox
,
2332 INT16 idStatic
, UINT16 attrib
)
2334 return DIALOG_DlgDirList( hDlg
, spec
, idLBox
, idStatic
, attrib
, FALSE
);
2338 /**********************************************************************
2339 * DlgDirListA (USER32.143)
2341 INT WINAPI
DlgDirListA( HWND hDlg
, LPSTR spec
, INT idLBox
,
2342 INT idStatic
, UINT attrib
)
2344 return DIALOG_DlgDirList( hDlg
, spec
, idLBox
, idStatic
, attrib
, FALSE
);
2348 /**********************************************************************
2349 * DlgDirListW (USER32.146)
2351 INT WINAPI
DlgDirListW( HWND hDlg
, LPWSTR spec
, INT idLBox
,
2352 INT idStatic
, UINT attrib
)
2354 return DIALOG_DlgDirListW( hDlg
, spec
, idLBox
, idStatic
, attrib
, FALSE
);
2358 /**********************************************************************
2359 * DlgDirListComboBox16 (USER.195)
2361 INT16 WINAPI
DlgDirListComboBox16( HWND16 hDlg
, LPSTR spec
, INT16 idCBox
,
2362 INT16 idStatic
, UINT16 attrib
)
2364 return DIALOG_DlgDirList( hDlg
, spec
, idCBox
, idStatic
, attrib
, TRUE
);
2368 /**********************************************************************
2369 * DlgDirListComboBoxA (USER32.144)
2371 INT WINAPI
DlgDirListComboBoxA( HWND hDlg
, LPSTR spec
, INT idCBox
,
2372 INT idStatic
, UINT attrib
)
2374 return DIALOG_DlgDirList( hDlg
, spec
, idCBox
, idStatic
, attrib
, TRUE
);
2378 /**********************************************************************
2379 * DlgDirListComboBoxW (USER32.145)
2381 INT WINAPI
DlgDirListComboBoxW( HWND hDlg
, LPWSTR spec
, INT idCBox
,
2382 INT idStatic
, UINT attrib
)
2384 return DIALOG_DlgDirListW( hDlg
, spec
, idCBox
, idStatic
, attrib
, TRUE
);