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
;
232 info
->data
= (LPVOID
)(*p
? p
+ 1 : NULL
); /* FIXME: should be a segptr */
236 TRACE(" %s %04x %d, %d, %d, %d, %d, %08lx, %08lx\n",
237 info
->className
, LOWORD(info
->windowName
),
238 info
->id
, info
->x
, info
->y
, info
->cx
, info
->cy
,
239 info
->style
, (DWORD
)info
->data
);
241 TRACE(" %s '%s' %d, %d, %d, %d, %d, %08lx, %08lx\n",
242 info
->className
, info
->windowName
,
243 info
->id
, info
->x
, info
->y
, info
->cx
, info
->cy
,
244 info
->style
, (DWORD
)info
->data
);
250 /***********************************************************************
251 * DIALOG_GetControl32
253 * Return the class and text of the control pointed to by ptr,
254 * fill the header structure and return a pointer to the next control.
256 static const WORD
*DIALOG_GetControl32( const WORD
*p
, DLG_CONTROL_INFO
*info
,
261 info
->helpId
= GET_DWORD(p
); p
+= 2;
262 info
->exStyle
= GET_DWORD(p
); p
+= 2;
263 info
->style
= GET_DWORD(p
); p
+= 2;
268 info
->style
= GET_DWORD(p
); p
+= 2;
269 info
->exStyle
= GET_DWORD(p
); p
+= 2;
271 info
->x
= GET_WORD(p
); p
++;
272 info
->y
= GET_WORD(p
); p
++;
273 info
->cx
= GET_WORD(p
); p
++;
274 info
->cy
= GET_WORD(p
); p
++;
278 /* id is a DWORD for DIALOGEX */
279 info
->id
= GET_DWORD(p
);
284 info
->id
= GET_WORD(p
);
288 if (GET_WORD(p
) == 0xffff)
290 static const WCHAR class_names
[6][10] =
292 { 'B','u','t','t','o','n', }, /* 0x80 */
293 { 'E','d','i','t', }, /* 0x81 */
294 { 'S','t','a','t','i','c', }, /* 0x82 */
295 { 'L','i','s','t','B','o','x', }, /* 0x83 */
296 { 'S','c','r','o','l','l','B','a','r', }, /* 0x84 */
297 { 'C','o','m','b','o','B','o','x', } /* 0x85 */
299 WORD id
= GET_WORD(p
+1);
300 if ((id
>= 0x80) && (id
<= 0x85))
301 info
->className
= (LPCSTR
)class_names
[id
- 0x80];
304 info
->className
= NULL
;
305 ERR("Unknown built-in class id %04x\n", id
);
311 info
->className
= (LPCSTR
)p
;
312 p
+= lstrlenW( (LPCWSTR
)p
) + 1;
315 if (GET_WORD(p
) == 0xffff) /* Is it an integer id? */
317 info
->windowName
= (LPCSTR
)(UINT
)GET_WORD(p
+ 1);
322 info
->windowName
= (LPCSTR
)p
;
323 p
+= lstrlenW( (LPCWSTR
)p
) + 1;
326 TRACE(" %s %s %d, %d, %d, %d, %d, %08lx, %08lx, %08lx\n",
327 debugstr_w( (LPCWSTR
)info
->className
),
328 debugres_w( (LPCWSTR
)info
->windowName
),
329 info
->id
, info
->x
, info
->y
, info
->cx
, info
->cy
,
330 info
->style
, info
->exStyle
, info
->helpId
);
334 if (TRACE_ON(dialog
))
336 WORD i
, count
= GET_WORD(p
) / sizeof(WORD
);
339 for (i
= 0; i
< count
; i
++) DPRINTF( "%04x,", GET_WORD(p
+i
+1) );
343 info
->data
= (LPVOID
)(p
+ 1);
344 p
+= GET_WORD(p
) / sizeof(WORD
);
346 else info
->data
= NULL
;
349 /* Next control is on dword boundary */
350 return (const WORD
*)((((int)p
) + 3) & ~3);
354 /***********************************************************************
355 * DIALOG_CreateControls
357 * Create the control windows for a dialog.
359 static BOOL
DIALOG_CreateControls( WND
*pWnd
, LPCSTR
template,
360 const DLG_TEMPLATE
*dlgTemplate
,
361 HINSTANCE hInst
, BOOL win32
)
363 DIALOGINFO
*dlgInfo
= (DIALOGINFO
*)pWnd
->wExtra
;
364 DLG_CONTROL_INFO info
;
365 HWND hwndCtrl
, hwndDefButton
= 0;
366 INT items
= dlgTemplate
->nbItems
;
373 HINSTANCE16 instance
;
374 template = DIALOG_GetControl16( template, &info
);
375 if (HIWORD(info
.className
) && !strcmp( info
.className
, "EDIT") &&
376 ((pWnd
->dwStyle
& DS_LOCALEDIT
) != DS_LOCALEDIT
))
378 if (!dlgInfo
->hDialogHeap
)
380 dlgInfo
->hDialogHeap
= GlobalAlloc16(GMEM_FIXED
, 0x10000);
381 if (!dlgInfo
->hDialogHeap
)
383 ERR("Insufficient memory to create heap for edit control\n" );
386 LocalInit16(dlgInfo
->hDialogHeap
, 0, 0xffff);
388 instance
= dlgInfo
->hDialogHeap
;
390 else instance
= (HINSTANCE16
)hInst
;
392 hwndCtrl
= CreateWindowEx16( info
.exStyle
| WS_EX_NOPARENTNOTIFY
,
393 info
.className
, info
.windowName
,
394 info
.style
| WS_CHILD
,
395 MulDiv(info
.x
, dlgInfo
->xBaseUnit
, 4),
396 MulDiv(info
.y
, dlgInfo
->yBaseUnit
, 8),
397 MulDiv(info
.cx
, dlgInfo
->xBaseUnit
, 4),
398 MulDiv(info
.cy
, dlgInfo
->yBaseUnit
, 8),
399 pWnd
->hwndSelf
, (HMENU16
)info
.id
,
400 instance
, info
.data
);
404 template = (LPCSTR
)DIALOG_GetControl32( (WORD
*)template, &info
,
405 dlgTemplate
->dialogEx
);
406 hwndCtrl
= CreateWindowExW( info
.exStyle
| WS_EX_NOPARENTNOTIFY
,
407 (LPCWSTR
)info
.className
,
408 (LPCWSTR
)info
.windowName
,
409 info
.style
| WS_CHILD
,
410 MulDiv(info
.x
, dlgInfo
->xBaseUnit
, 4),
411 MulDiv(info
.y
, dlgInfo
->yBaseUnit
, 8),
412 MulDiv(info
.cx
, dlgInfo
->xBaseUnit
, 4),
413 MulDiv(info
.cy
, dlgInfo
->yBaseUnit
, 8),
414 pWnd
->hwndSelf
, (HMENU
)info
.id
,
417 if (!hwndCtrl
) return FALSE
;
419 /* Send initialisation messages to the control */
420 if (dlgInfo
->hUserFont
) SendMessageA( hwndCtrl
, WM_SETFONT
,
421 (WPARAM
)dlgInfo
->hUserFont
, 0 );
422 if (SendMessageA(hwndCtrl
, WM_GETDLGCODE
, 0, 0) & DLGC_DEFPUSHBUTTON
)
424 /* If there's already a default push-button, set it back */
425 /* to normal and use this one instead. */
427 SendMessageA( hwndDefButton
, BM_SETSTYLE
,
428 BS_PUSHBUTTON
,FALSE
);
429 hwndDefButton
= hwndCtrl
;
430 dlgInfo
->idResult
= GetWindowWord( hwndCtrl
, GWW_ID
);
438 /***********************************************************************
439 * DIALOG_ParseTemplate16
441 * Fill a DLG_TEMPLATE structure from the dialog template, and return
442 * a pointer to the first control.
444 static LPCSTR
DIALOG_ParseTemplate16( LPCSTR p
, DLG_TEMPLATE
* result
)
446 result
->style
= GET_DWORD(p
); p
+= sizeof(DWORD
);
448 result
->nbItems
= (unsigned char) *p
++;
449 result
->x
= GET_WORD(p
); p
+= sizeof(WORD
);
450 result
->y
= GET_WORD(p
); p
+= sizeof(WORD
);
451 result
->cx
= GET_WORD(p
); p
+= sizeof(WORD
);
452 result
->cy
= GET_WORD(p
); p
+= sizeof(WORD
);
453 TRACE("DIALOG %d, %d, %d, %d\n",
454 result
->x
, result
->y
, result
->cx
, result
->cy
);
455 TRACE(" STYLE %08lx\n", result
->style
);
457 /* Get the menu name */
462 result
->menuName
= 0;
466 result
->menuName
= (LPCSTR
)(UINT
)GET_WORD( p
+ 1 );
468 TRACE(" MENU %04x\n", LOWORD(result
->menuName
) );
471 result
->menuName
= p
;
472 TRACE(" MENU '%s'\n", p
);
477 /* Get the class name */
481 result
->className
= p
;
482 TRACE(" CLASS '%s'\n", result
->className
);
484 else result
->className
= DIALOG_CLASS_ATOM
;
487 /* Get the window caption */
491 TRACE(" CAPTION '%s'\n", result
->caption
);
493 /* Get the font name */
495 if (result
->style
& DS_SETFONT
)
497 result
->pointSize
= GET_WORD(p
);
499 result
->faceName
= p
;
501 TRACE(" FONT %d,'%s'\n",
502 result
->pointSize
, result
->faceName
);
508 /***********************************************************************
509 * DIALOG_ParseTemplate32
511 * Fill a DLG_TEMPLATE structure from the dialog template, and return
512 * a pointer to the first control.
514 static LPCSTR
DIALOG_ParseTemplate32( LPCSTR
template, DLG_TEMPLATE
* result
)
516 const WORD
*p
= (const WORD
*)template;
518 result
->style
= GET_DWORD(p
); p
+= 2;
519 if (result
->style
== 0xffff0001) /* DIALOGEX resource */
521 result
->dialogEx
= TRUE
;
522 result
->helpId
= GET_DWORD(p
); p
+= 2;
523 result
->exStyle
= GET_DWORD(p
); p
+= 2;
524 result
->style
= GET_DWORD(p
); p
+= 2;
528 result
->dialogEx
= FALSE
;
530 result
->exStyle
= GET_DWORD(p
); p
+= 2;
532 result
->nbItems
= GET_WORD(p
); p
++;
533 result
->x
= GET_WORD(p
); p
++;
534 result
->y
= GET_WORD(p
); p
++;
535 result
->cx
= GET_WORD(p
); p
++;
536 result
->cy
= GET_WORD(p
); p
++;
537 TRACE("DIALOG%s %d, %d, %d, %d, %ld\n",
538 result
->dialogEx
? "EX" : "", result
->x
, result
->y
,
539 result
->cx
, result
->cy
, result
->helpId
);
540 TRACE(" STYLE 0x%08lx\n", result
->style
);
541 TRACE(" EXSTYLE 0x%08lx\n", result
->exStyle
);
543 /* Get the menu name */
548 result
->menuName
= NULL
;
552 result
->menuName
= (LPCSTR
)(UINT
)GET_WORD( p
+ 1 );
554 TRACE(" MENU %04x\n", LOWORD(result
->menuName
) );
557 result
->menuName
= (LPCSTR
)p
;
558 TRACE(" MENU %s\n", debugstr_w( (LPCWSTR
)p
));
559 p
+= lstrlenW( (LPCWSTR
)p
) + 1;
563 /* Get the class name */
568 result
->className
= DIALOG_CLASS_ATOM
;
572 result
->className
= (LPCSTR
)(UINT
)GET_WORD( p
+ 1 );
574 TRACE(" CLASS %04x\n", LOWORD(result
->className
) );
577 result
->className
= (LPCSTR
)p
;
578 TRACE(" CLASS %s\n", debugstr_w( (LPCWSTR
)p
));
579 p
+= lstrlenW( (LPCWSTR
)p
) + 1;
583 /* Get the window caption */
585 result
->caption
= (LPCSTR
)p
;
586 p
+= lstrlenW( (LPCWSTR
)p
) + 1;
587 TRACE(" CAPTION %s\n", debugstr_w( (LPCWSTR
)result
->caption
) );
589 /* Get the font name */
591 if (result
->style
& DS_SETFONT
)
593 result
->pointSize
= GET_WORD(p
);
595 if (result
->dialogEx
)
597 result
->weight
= GET_WORD(p
); p
++;
598 result
->italic
= LOBYTE(GET_WORD(p
)); p
++;
602 result
->weight
= FW_DONTCARE
;
603 result
->italic
= FALSE
;
605 result
->faceName
= (LPCSTR
)p
;
606 p
+= lstrlenW( (LPCWSTR
)p
) + 1;
607 TRACE(" FONT %d, %s, %d, %s\n",
608 result
->pointSize
, debugstr_w( (LPCWSTR
)result
->faceName
),
609 result
->weight
, result
->italic
? "TRUE" : "FALSE" );
612 /* First control is on dword boundary */
613 return (LPCSTR
)((((int)p
) + 3) & ~3);
617 /***********************************************************************
618 * DIALOG_CreateIndirect
620 HWND
DIALOG_CreateIndirect( HINSTANCE hInst
, LPCSTR dlgTemplate
,
621 BOOL win32Template
, HWND owner
,
622 DLGPROC16 dlgProc
, LPARAM param
,
623 WINDOWPROCTYPE procType
)
630 DLG_TEMPLATE
template;
631 DIALOGINFO
* dlgInfo
;
632 WORD xUnit
= xBaseUnit
;
633 WORD yUnit
= yBaseUnit
;
635 /* Parse dialog template */
637 if (!dlgTemplate
) return 0;
639 dlgTemplate
= DIALOG_ParseTemplate32( dlgTemplate
, &template );
641 dlgTemplate
= DIALOG_ParseTemplate16( dlgTemplate
, &template );
645 if (template.menuName
)
649 LPSTR str
= SEGPTR_STRDUP( template.menuName
);
650 hMenu
= LoadMenu16( hInst
, SEGPTR_GET(str
) );
653 else hMenu
= LoadMenuW( hInst
, (LPCWSTR
)template.menuName
);
656 /* Create custom font if needed */
658 if (template.style
& DS_SETFONT
)
660 /* The font height must be negative as it is a point size */
661 /* and must be converted to pixels first */
662 /* (see CreateFont() documentation in the Windows SDK). */
664 int pixels
= template.pointSize
* GetDeviceCaps(dc
, LOGPIXELSY
)/72;
668 hFont
= CreateFontW( -pixels
, 0, 0, 0, template.weight
,
669 template.italic
, FALSE
, FALSE
,
670 DEFAULT_CHARSET
, 0, 0,
671 PROOF_QUALITY
, FF_DONTCARE
,
672 (LPCWSTR
)template.faceName
);
674 hFont
= CreateFont16( -pixels
, 0, 0, 0, FW_DONTCARE
,
676 DEFAULT_CHARSET
, 0, 0,
677 PROOF_QUALITY
, FF_DONTCARE
,
682 DIALOG_GetCharSize(hFont
,&charSize
);
686 TRACE("units = %d,%d\n", xUnit
, yUnit
);
689 /* Create dialog main window */
691 rect
.left
= rect
.top
= 0;
692 rect
.right
= MulDiv(template.cx
, xUnit
, 4);
693 rect
.bottom
= MulDiv(template.cy
, yUnit
, 8);
694 if (template.style
& DS_MODALFRAME
)
695 template.exStyle
|= WS_EX_DLGMODALFRAME
;
696 AdjustWindowRectEx( &rect
, template.style
,
697 hMenu
? TRUE
: FALSE
, template.exStyle
);
698 rect
.right
-= rect
.left
;
699 rect
.bottom
-= rect
.top
;
701 if ((INT16
)template.x
== CW_USEDEFAULT16
)
703 rect
.left
= rect
.top
= win32Template
? CW_USEDEFAULT
: CW_USEDEFAULT16
;
707 if (template.style
& DS_CENTER
)
709 rect
.left
= (GetSystemMetrics(SM_CXSCREEN
) - rect
.right
) / 2;
710 rect
.top
= (GetSystemMetrics(SM_CYSCREEN
) - rect
.bottom
) / 2;
714 rect
.left
+= MulDiv(template.x
, xUnit
, 4);
715 rect
.top
+= MulDiv(template.y
, yUnit
, 8);
717 if ( !(template.style
& WS_CHILD
) )
721 if( !(template.style
& DS_ABSALIGN
) )
722 ClientToScreen( owner
, (POINT
*)&rect
);
724 /* try to fit it into the desktop */
726 if( (dX
= rect
.left
+ rect
.right
+ GetSystemMetrics(SM_CXDLGFRAME
)
727 - GetSystemMetrics(SM_CXSCREEN
)) > 0 ) rect
.left
-= dX
;
728 if( (dY
= rect
.top
+ rect
.bottom
+ GetSystemMetrics(SM_CYDLGFRAME
)
729 - GetSystemMetrics(SM_CYSCREEN
)) > 0 ) rect
.top
-= dY
;
730 if( rect
.left
< 0 ) rect
.left
= 0;
731 if( rect
.top
< 0 ) rect
.top
= 0;
736 hwnd
= CreateWindowEx16(template.exStyle
, template.className
,
737 template.caption
, template.style
& ~WS_VISIBLE
,
738 rect
.left
, rect
.top
, rect
.right
, rect
.bottom
,
739 owner
, hMenu
, hInst
, NULL
);
741 hwnd
= CreateWindowExW(template.exStyle
, (LPCWSTR
)template.className
,
742 (LPCWSTR
)template.caption
,
743 template.style
& ~WS_VISIBLE
,
744 rect
.left
, rect
.top
, rect
.right
, rect
.bottom
,
745 owner
, hMenu
, hInst
, NULL
);
749 if (hFont
) DeleteObject( hFont
);
750 if (hMenu
) DestroyMenu( hMenu
);
753 wndPtr
= WIN_FindWndPtr( hwnd
);
754 wndPtr
->flags
|= WIN_ISDIALOG
;
755 wndPtr
->helpContext
= template.helpId
;
757 /* Initialise dialog extra data */
759 dlgInfo
= (DIALOGINFO
*)wndPtr
->wExtra
;
760 WINPROC_SetProc( &dlgInfo
->dlgProc
, (WNDPROC16
)dlgProc
, procType
, WIN_PROC_WINDOW
);
761 dlgInfo
->hUserFont
= hFont
;
762 dlgInfo
->hMenu
= hMenu
;
763 dlgInfo
->xBaseUnit
= xUnit
;
764 dlgInfo
->yBaseUnit
= yUnit
;
765 dlgInfo
->msgResult
= 0;
766 dlgInfo
->idResult
= 0;
768 dlgInfo
->hDialogHeap
= 0;
770 if (dlgInfo
->hUserFont
)
771 SendMessageA( hwnd
, WM_SETFONT
, (WPARAM
)dlgInfo
->hUserFont
, 0 );
773 /* Create controls */
775 if (DIALOG_CreateControls( wndPtr
, dlgTemplate
, &template,
776 hInst
, win32Template
))
778 HWND hwndPreInitFocus
;
780 /* Send initialisation messages and set focus */
782 dlgInfo
->hwndFocus
= GetNextDlgTabItem( hwnd
, 0, FALSE
);
784 hwndPreInitFocus
= GetFocus();
785 if (SendMessageA( hwnd
, WM_INITDIALOG
, (WPARAM
)dlgInfo
->hwndFocus
, param
))
786 SetFocus( dlgInfo
->hwndFocus
);
789 /* If the dlgproc has returned FALSE (indicating handling of keyboard focus)
790 but the focus has not changed, set the focus where we expect it. */
791 if ( GetFocus() == hwndPreInitFocus
)
792 SetFocus( dlgInfo
->hwndFocus
);
795 if (template.style
& WS_VISIBLE
&& !(wndPtr
->dwStyle
& WS_VISIBLE
))
797 ShowWindow( hwnd
, SW_SHOWNORMAL
); /* SW_SHOW doesn't always work */
798 UpdateWindow( hwnd
);
800 WIN_ReleaseWndPtr(wndPtr
);
803 WIN_ReleaseWndPtr(wndPtr
);
804 if( IsWindow(hwnd
) ) DestroyWindow( hwnd
);
809 /***********************************************************************
810 * CreateDialog16 (USER.89)
812 HWND16 WINAPI
CreateDialog16( HINSTANCE16 hInst
, SEGPTR dlgTemplate
,
813 HWND16 owner
, DLGPROC16 dlgProc
)
815 return CreateDialogParam16( hInst
, dlgTemplate
, owner
, dlgProc
, 0 );
819 /***********************************************************************
820 * CreateDialogParam16 (USER.241)
822 HWND16 WINAPI
CreateDialogParam16( HINSTANCE16 hInst
, SEGPTR dlgTemplate
,
823 HWND16 owner
, DLGPROC16 dlgProc
,
831 TRACE("%04x,%08lx,%04x,%08lx,%ld\n",
832 hInst
, (DWORD
)dlgTemplate
, owner
, (DWORD
)dlgProc
, param
);
834 if (!(hRsrc
= FindResource16( hInst
, dlgTemplate
, RT_DIALOG16
))) return 0;
835 if (!(hmem
= LoadResource16( hInst
, hRsrc
))) return 0;
836 if (!(data
= LockResource16( hmem
))) hwnd
= 0;
837 else hwnd
= CreateDialogIndirectParam16( hInst
, data
, owner
,
839 FreeResource16( hmem
);
843 /***********************************************************************
844 * CreateDialogParam32A (USER32.73)
846 HWND WINAPI
CreateDialogParamA( HINSTANCE hInst
, LPCSTR name
,
847 HWND owner
, DLGPROC dlgProc
,
850 HANDLE hrsrc
= FindResourceA( hInst
, name
, RT_DIALOGA
);
851 if (!hrsrc
) return 0;
852 return CreateDialogIndirectParamA( hInst
,
853 (LPVOID
)LoadResource(hInst
, hrsrc
),
854 owner
, dlgProc
, param
);
858 /***********************************************************************
859 * CreateDialogParam32W (USER32.74)
861 HWND WINAPI
CreateDialogParamW( HINSTANCE hInst
, LPCWSTR name
,
862 HWND owner
, DLGPROC dlgProc
,
865 HANDLE hrsrc
= FindResourceW( hInst
, name
, RT_DIALOGW
);
866 if (!hrsrc
) return 0;
867 return CreateDialogIndirectParamW( hInst
,
868 (LPVOID
)LoadResource(hInst
, hrsrc
),
869 owner
, dlgProc
, param
);
873 /***********************************************************************
874 * CreateDialogIndirect16 (USER.219)
876 HWND16 WINAPI
CreateDialogIndirect16( HINSTANCE16 hInst
, LPCVOID dlgTemplate
,
877 HWND16 owner
, DLGPROC16 dlgProc
)
879 return CreateDialogIndirectParam16( hInst
, dlgTemplate
, owner
, dlgProc
, 0);
883 /***********************************************************************
884 * CreateDialogIndirectParam16 (USER.242)
886 HWND16 WINAPI
CreateDialogIndirectParam16( HINSTANCE16 hInst
,
888 HWND16 owner
, DLGPROC16 dlgProc
,
891 return DIALOG_CreateIndirect( hInst
, dlgTemplate
, FALSE
, owner
,
892 dlgProc
, param
, WIN_PROC_16
);
896 /***********************************************************************
897 * CreateDialogIndirectParam32A (USER32.69)
899 HWND WINAPI
CreateDialogIndirectParamA( HINSTANCE hInst
,
901 HWND owner
, DLGPROC dlgProc
,
904 return DIALOG_CreateIndirect( hInst
, dlgTemplate
, TRUE
, owner
,
905 (DLGPROC16
)dlgProc
, param
, WIN_PROC_32A
);
908 /***********************************************************************
909 * CreateDialogIndirectParam32AorW (USER32.71)
911 HWND WINAPI
CreateDialogIndirectParamAorW( HINSTANCE hInst
,
913 HWND owner
, DLGPROC dlgProc
,
915 { FIXME("assume WIN_PROC_32W\n");
916 return DIALOG_CreateIndirect( hInst
, dlgTemplate
, TRUE
, owner
,
917 (DLGPROC16
)dlgProc
, param
, WIN_PROC_32W
);
920 /***********************************************************************
921 * CreateDialogIndirectParam32W (USER32.72)
923 HWND WINAPI
CreateDialogIndirectParamW( HINSTANCE hInst
,
925 HWND owner
, DLGPROC dlgProc
,
928 return DIALOG_CreateIndirect( hInst
, dlgTemplate
, TRUE
, owner
,
929 (DLGPROC16
)dlgProc
, param
, WIN_PROC_32W
);
933 /***********************************************************************
936 INT
DIALOG_DoDialogBox( HWND hwnd
, HWND owner
)
939 DIALOGINFO
* dlgInfo
;
943 /* Owner must be a top-level window */
944 owner
= WIN_GetTopParent( owner
);
945 if (!(wndPtr
= WIN_FindWndPtr( hwnd
))) return -1;
946 dlgInfo
= (DIALOGINFO
*)wndPtr
->wExtra
;
948 if (!dlgInfo
->flags
& DF_END
) /* was EndDialog called in WM_INITDIALOG ? */
950 EnableWindow( owner
, FALSE
);
951 ShowWindow( hwnd
, SW_SHOW
);
952 while (MSG_InternalGetMessage(QMSG_WIN32A
, &msg
, hwnd
, owner
, MSGF_DIALOGBOX
,
953 PM_REMOVE
, !(wndPtr
->dwStyle
& DS_NOIDLEMSG
), NULL
))
955 if (!IsDialogMessageA( hwnd
, &msg
))
957 TranslateMessage( &msg
);
958 DispatchMessageA( &msg
);
960 if (dlgInfo
->flags
& DF_END
) break;
962 EnableWindow( owner
, TRUE
);
964 retval
= dlgInfo
->idResult
;
965 WIN_ReleaseWndPtr(wndPtr
);
966 DestroyWindow( hwnd
);
971 /***********************************************************************
972 * DialogBox16 (USER.87)
974 INT16 WINAPI
DialogBox16( HINSTANCE16 hInst
, SEGPTR dlgTemplate
,
975 HWND16 owner
, DLGPROC16 dlgProc
)
977 return DialogBoxParam16( hInst
, dlgTemplate
, owner
, dlgProc
, 0 );
981 /***********************************************************************
982 * DialogBoxParam16 (USER.239)
984 INT16 WINAPI
DialogBoxParam16( HINSTANCE16 hInst
, SEGPTR
template,
985 HWND16 owner
, DLGPROC16 dlgProc
, LPARAM param
)
987 HWND16 hwnd
= CreateDialogParam16( hInst
, template, owner
, dlgProc
, param
);
988 if (hwnd
) return (INT16
)DIALOG_DoDialogBox( hwnd
, owner
);
993 /***********************************************************************
994 * DialogBoxParam32A (USER32.139)
996 INT WINAPI
DialogBoxParamA( HINSTANCE hInst
, LPCSTR name
,
997 HWND owner
, DLGPROC dlgProc
, LPARAM param
)
999 HWND hwnd
= CreateDialogParamA( hInst
, name
, owner
, dlgProc
, param
);
1000 if (hwnd
) return DIALOG_DoDialogBox( hwnd
, owner
);
1005 /***********************************************************************
1006 * DialogBoxParam32W (USER32.140)
1008 INT WINAPI
DialogBoxParamW( HINSTANCE hInst
, LPCWSTR name
,
1009 HWND owner
, DLGPROC dlgProc
, LPARAM param
)
1011 HWND hwnd
= CreateDialogParamW( hInst
, name
, owner
, dlgProc
, param
);
1012 if (hwnd
) return DIALOG_DoDialogBox( hwnd
, owner
);
1017 /***********************************************************************
1018 * DialogBoxIndirect16 (USER.218)
1020 INT16 WINAPI
DialogBoxIndirect16( HINSTANCE16 hInst
, HANDLE16 dlgTemplate
,
1021 HWND16 owner
, DLGPROC16 dlgProc
)
1023 return DialogBoxIndirectParam16( hInst
, dlgTemplate
, owner
, dlgProc
, 0 );
1027 /***********************************************************************
1028 * DialogBoxIndirectParam16 (USER.240)
1030 INT16 WINAPI
DialogBoxIndirectParam16( HINSTANCE16 hInst
, HANDLE16 dlgTemplate
,
1031 HWND16 owner
, DLGPROC16 dlgProc
,
1037 if (!(ptr
= GlobalLock16( dlgTemplate
))) return -1;
1038 hwnd
= CreateDialogIndirectParam16( hInst
, ptr
, owner
, dlgProc
, param
);
1039 GlobalUnlock16( dlgTemplate
);
1040 if (hwnd
) return (INT16
)DIALOG_DoDialogBox( hwnd
, owner
);
1045 /***********************************************************************
1046 * DialogBoxIndirectParam32A (USER32.136)
1048 INT WINAPI
DialogBoxIndirectParamA(HINSTANCE hInstance
, LPCVOID
template,
1049 HWND owner
, DLGPROC dlgProc
,
1052 HWND hwnd
= CreateDialogIndirectParamA( hInstance
, template,
1053 owner
, dlgProc
, param
);
1054 if (hwnd
) return DIALOG_DoDialogBox( hwnd
, owner
);
1059 /***********************************************************************
1060 * DialogBoxIndirectParam32W (USER32.138)
1062 INT WINAPI
DialogBoxIndirectParamW(HINSTANCE hInstance
, LPCVOID
template,
1063 HWND owner
, DLGPROC dlgProc
,
1066 HWND hwnd
= CreateDialogIndirectParamW( hInstance
, template,
1067 owner
, dlgProc
, param
);
1068 if (hwnd
) return DIALOG_DoDialogBox( hwnd
, owner
);
1072 /***********************************************************************
1073 * DialogBoxIndirectParamAorW (USER32.138)
1075 INT WINAPI
DialogBoxIndirectParamAorW(HINSTANCE hInstance
, LPCVOID
template,
1076 HWND owner
, DLGPROC dlgProc
,
1077 LPARAM param
, DWORD x
)
1080 FIXME("0x%08x %p 0x%08x %p 0x%08lx 0x%08lx\n",
1081 hInstance
, template, owner
, dlgProc
, param
, x
);
1082 hwnd
= CreateDialogIndirectParamW( hInstance
, template,
1083 owner
, dlgProc
, param
);
1084 if (hwnd
) return DIALOG_DoDialogBox( hwnd
, owner
);
1088 /***********************************************************************
1089 * EndDialog16 (USER.88)
1091 BOOL16 WINAPI
EndDialog16( HWND16 hwnd
, INT16 retval
)
1093 return EndDialog( hwnd
, retval
);
1097 /***********************************************************************
1098 * EndDialog32 (USER32.173)
1100 BOOL WINAPI
EndDialog( HWND hwnd
, INT retval
)
1102 WND
* wndPtr
= WIN_FindWndPtr( hwnd
);
1103 DIALOGINFO
* dlgInfo
;
1106 TRACE("%04x %d\n", hwnd
, retval
);
1110 ERR("got invalid window handle (%04x); buggy app !?\n", hwnd
);
1114 if ((dlgInfo
= (DIALOGINFO
*)wndPtr
->wExtra
))
1116 dlgInfo
->idResult
= retval
;
1117 dlgInfo
->flags
|= DF_END
;
1121 hOwner
= WIN_GetTopParent( wndPtr
->owner
->hwndSelf
);
1123 /* Enable the owner first */
1124 if (hOwner
&& !IsWindowEnabled(hOwner
))
1125 EnableWindow( hOwner
, TRUE
);
1127 /* Windows sets the focus to the dialog itself in EndDialog */
1129 if (IsChild(hwnd
, GetFocus()))
1130 SetFocus(wndPtr
->hwndSelf
);
1132 /* Don't have to send a ShowWindow(SW_HIDE), just do
1133 SetWindowPos with SWP_HIDEWINDOW as done in Windows */
1135 SetWindowPos(hwnd
, (HWND
)0, 0, 0, 0, 0, SWP_NOMOVE
| SWP_NOSIZE
1136 | SWP_NOZORDER
| SWP_NOACTIVATE
| SWP_HIDEWINDOW
);
1138 WIN_ReleaseWndPtr(wndPtr
);
1144 /***********************************************************************
1145 * DIALOG_IsAccelerator
1147 static BOOL
DIALOG_IsAccelerator( HWND hwnd
, HWND hwndDlg
, WPARAM vKey
)
1149 HWND hwndControl
= hwnd
;
1152 BOOL RetVal
= FALSE
;
1157 wndPtr
= WIN_FindWndPtr( hwndControl
);
1158 if ( (wndPtr
!= NULL
) &&
1159 ((wndPtr
->dwStyle
& (WS_VISIBLE
| WS_DISABLED
)) == WS_VISIBLE
) )
1161 dlgCode
= SendMessageA( hwndControl
, WM_GETDLGCODE
, 0, 0 );
1162 if ( (dlgCode
& (DLGC_BUTTON
| DLGC_STATIC
)) &&
1163 (wndPtr
->text
!=NULL
))
1165 /* find the accelerator key */
1166 LPSTR p
= wndPtr
->text
- 2;
1169 p
= strchr( p
+ 2, '&' );
1171 while (p
!= NULL
&& p
[1] == '&');
1173 /* and check if it's the one we're looking for */
1174 if (p
!= NULL
&& toupper( p
[1] ) == toupper( vKey
) )
1176 if ((dlgCode
& DLGC_STATIC
) ||
1177 (wndPtr
->dwStyle
& 0x0f) == BS_GROUPBOX
)
1179 /* set focus to the control */
1180 SendMessageA( hwndDlg
, WM_NEXTDLGCTL
,
1182 /* and bump it on to next */
1183 SendMessageA( hwndDlg
, WM_NEXTDLGCTL
, 0, 0);
1185 else if (dlgCode
& DLGC_BUTTON
)
1187 /* send BM_CLICK message to the control */
1188 SendMessageA( hwndControl
, BM_CLICK
, 0, 0 );
1192 WIN_ReleaseWndPtr(wndPtr
);
1196 hwndNext
= GetWindow( hwndControl
, GW_CHILD
);
1202 WIN_ReleaseWndPtr(wndPtr
);
1205 hwndNext
= GetWindow( hwndControl
, GW_HWNDNEXT
);
1207 while (!hwndNext
&& hwndControl
)
1209 hwndControl
= GetParent( hwndControl
);
1210 if (hwndControl
== hwndDlg
)
1212 if(hwnd
==hwndDlg
){ /* prevent endless loop */
1216 hwndNext
= GetWindow( hwndDlg
, GW_CHILD
);
1220 hwndNext
= GetWindow( hwndControl
, GW_HWNDNEXT
);
1223 hwndControl
= hwndNext
;
1225 while (hwndControl
&& (hwndControl
!= hwnd
));
1230 /***********************************************************************
1231 * DIALOG_FindMsgDestination
1233 * The messages that IsDialogMessage send may not go to the dialog
1234 * calling IsDialogMessage if that dialog is a child, and it has the
1235 * DS_CONTROL style set.
1236 * We propagate up until we hit a that does not have DS_CONTROL, or
1237 * whose parent is not a dialog.
1239 * This is undocumented behaviour.
1241 static HWND
DIALOG_FindMsgDestination( HWND hwndDlg
)
1243 while (GetWindowLongA(hwndDlg
, GWL_STYLE
) & DS_CONTROL
)
1246 HWND hParent
= GetParent(hwndDlg
);
1247 if (!hParent
) break;
1249 pParent
= WIN_FindWndPtr(hParent
);
1250 if (!pParent
) break;
1252 if (!(pParent
->flags
& WIN_ISDIALOG
))
1254 WIN_ReleaseWndPtr(pParent
);
1257 WIN_ReleaseWndPtr(pParent
);
1265 /***********************************************************************
1266 * DIALOG_IsDialogMessage
1268 static BOOL
DIALOG_IsDialogMessage( HWND hwnd
, HWND hwndDlg
,
1269 UINT message
, WPARAM wParam
,
1270 LPARAM lParam
, BOOL
*translate
,
1271 BOOL
*dispatch
, INT dlgCode
)
1273 *translate
= *dispatch
= FALSE
;
1275 if (message
== WM_PAINT
)
1277 /* Apparently, we have to handle this one as well */
1282 /* Only the key messages get special processing */
1283 if ((message
!= WM_KEYDOWN
) &&
1284 (message
!= WM_SYSCHAR
) &&
1285 (message
!= WM_CHAR
))
1288 if (dlgCode
& DLGC_WANTMESSAGE
)
1290 *translate
= *dispatch
= TRUE
;
1294 hwndDlg
= DIALOG_FindMsgDestination(hwndDlg
);
1302 if (!(dlgCode
& DLGC_WANTTAB
))
1304 SendMessageA( hwndDlg
, WM_NEXTDLGCTL
,
1305 (GetKeyState(VK_SHIFT
) & 0x8000), 0 );
1314 if (!(dlgCode
& DLGC_WANTARROWS
))
1316 BOOL fPrevious
= (wParam
== VK_LEFT
|| wParam
== VK_UP
);
1318 GetNextDlgGroupItem (hwndDlg
, GetFocus(), fPrevious
);
1319 SendMessageA( hwndDlg
, WM_NEXTDLGCTL
, hwndNext
, 1 );
1325 SendMessageA( hwndDlg
, WM_COMMAND
, IDCANCEL
,
1326 (LPARAM
)GetDlgItem( hwndDlg
, IDCANCEL
) );
1331 DWORD dw
= SendMessage16( hwndDlg
, DM_GETDEFID
, 0, 0 );
1332 if (HIWORD(dw
) == DC_HASDEFID
)
1334 SendMessageA( hwndDlg
, WM_COMMAND
,
1335 MAKEWPARAM( LOWORD(dw
), BN_CLICKED
),
1336 (LPARAM
)GetDlgItem(hwndDlg
, LOWORD(dw
)));
1340 SendMessageA( hwndDlg
, WM_COMMAND
, IDOK
,
1341 (LPARAM
)GetDlgItem( hwndDlg
, IDOK
) );
1348 break; /* case WM_KEYDOWN */
1351 if (dlgCode
& DLGC_WANTCHARS
) break;
1355 if (DIALOG_IsAccelerator( hwnd
, hwndDlg
, wParam
))
1357 /* don't translate or dispatch */
1363 /* If we get here, the message has not been treated specially */
1364 /* and can be sent to its destination window. */
1370 /***********************************************************************
1371 * IsDialogMessage16 (USER.90)
1373 BOOL16 WINAPI
WIN16_IsDialogMessage16( HWND16 hwndDlg
, SEGPTR msg16
)
1375 LPMSG16 msg
= PTR_SEG_TO_LIN(msg16
);
1376 BOOL ret
, translate
, dispatch
;
1379 if ((hwndDlg
!= msg
->hwnd
) && !IsChild16( hwndDlg
, msg
->hwnd
))
1382 if ((msg
->message
== WM_KEYDOWN
) ||
1383 (msg
->message
== WM_SYSCHAR
) ||
1384 (msg
->message
== WM_CHAR
))
1386 dlgCode
= SendMessage16( msg
->hwnd
, WM_GETDLGCODE
, 0, (LPARAM
)msg16
);
1388 ret
= DIALOG_IsDialogMessage( msg
->hwnd
, hwndDlg
, msg
->message
,
1389 msg
->wParam
, msg
->lParam
,
1390 &translate
, &dispatch
, dlgCode
);
1391 if (translate
) TranslateMessage16( msg
);
1392 if (dispatch
) DispatchMessage16( msg
);
1397 BOOL16 WINAPI
IsDialogMessage16( HWND16 hwndDlg
, LPMSG16 msg
)
1399 LPMSG16 msg16
= SEGPTR_NEW(MSG16
);
1403 ret
= WIN16_IsDialogMessage16( hwndDlg
, SEGPTR_GET(msg16
) );
1408 /***********************************************************************
1409 * IsDialogMessage32A (USER32.342)
1411 BOOL WINAPI
IsDialogMessageA( HWND hwndDlg
, LPMSG msg
)
1413 BOOL ret
, translate
, dispatch
;
1416 if ((hwndDlg
!= msg
->hwnd
) && !IsChild( hwndDlg
, msg
->hwnd
))
1419 if ((msg
->message
== WM_KEYDOWN
) ||
1420 (msg
->message
== WM_SYSCHAR
) ||
1421 (msg
->message
== WM_CHAR
))
1423 dlgCode
= SendMessageA( msg
->hwnd
, WM_GETDLGCODE
, 0, (LPARAM
)msg
);
1425 ret
= DIALOG_IsDialogMessage( msg
->hwnd
, hwndDlg
, msg
->message
,
1426 msg
->wParam
, msg
->lParam
,
1427 &translate
, &dispatch
, dlgCode
);
1428 if (translate
) TranslateMessage( msg
);
1429 if (dispatch
) DispatchMessageA( msg
);
1434 /***********************************************************************
1435 * IsDialogMessage32W (USER32.343)
1437 BOOL WINAPI
IsDialogMessageW( HWND hwndDlg
, LPMSG msg
)
1439 BOOL ret
, translate
, dispatch
;
1442 if ((hwndDlg
!= msg
->hwnd
) && !IsChild( hwndDlg
, msg
->hwnd
))
1445 if ((msg
->message
== WM_KEYDOWN
) ||
1446 (msg
->message
== WM_SYSCHAR
) ||
1447 (msg
->message
== WM_CHAR
))
1449 dlgCode
= SendMessageW( msg
->hwnd
, WM_GETDLGCODE
, 0, (LPARAM
)msg
);
1451 ret
= DIALOG_IsDialogMessage( msg
->hwnd
, hwndDlg
, msg
->message
,
1452 msg
->wParam
, msg
->lParam
,
1453 &translate
, &dispatch
, dlgCode
);
1454 if (translate
) TranslateMessage( msg
);
1455 if (dispatch
) DispatchMessageW( msg
);
1460 /****************************************************************
1461 * GetDlgCtrlID16 (USER.277)
1463 INT16 WINAPI
GetDlgCtrlID16( HWND16 hwnd
)
1465 WND
*wndPtr
= WIN_FindWndPtr(hwnd
);
1468 if (!wndPtr
) return 0;
1470 retvalue
= wndPtr
->wIDmenu
;
1471 WIN_ReleaseWndPtr(wndPtr
);
1476 /****************************************************************
1477 * GetDlgCtrlID32 (USER32.234)
1479 INT WINAPI
GetDlgCtrlID( HWND hwnd
)
1482 WND
*wndPtr
= WIN_FindWndPtr(hwnd
);
1483 if (!wndPtr
) return 0;
1484 retvalue
= wndPtr
->wIDmenu
;
1485 WIN_ReleaseWndPtr(wndPtr
);
1490 /***********************************************************************
1491 * GetDlgItem16 (USER.91)
1493 HWND16 WINAPI
GetDlgItem16( HWND16 hwndDlg
, INT16 id
)
1497 if (!(pWnd
= WIN_FindWndPtr( hwndDlg
))) return 0;
1498 for (WIN_UpdateWndPtr(&pWnd
,pWnd
->child
); pWnd
; WIN_UpdateWndPtr(&pWnd
,pWnd
->next
))
1499 if (pWnd
->wIDmenu
== (UINT16
)id
)
1501 HWND16 retvalue
= pWnd
->hwndSelf
;
1502 WIN_ReleaseWndPtr(pWnd
);
1509 /***********************************************************************
1510 * GetDlgItem32 (USER32.235)
1512 HWND WINAPI
GetDlgItem( HWND hwndDlg
, INT 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 HWND retvalue
= pWnd
->hwndSelf
;
1521 WIN_ReleaseWndPtr(pWnd
);
1528 /*******************************************************************
1529 * SendDlgItemMessage16 (USER.101)
1531 LRESULT WINAPI
SendDlgItemMessage16( HWND16 hwnd
, INT16 id
, UINT16 msg
,
1532 WPARAM16 wParam
, LPARAM lParam
)
1534 HWND16 hwndCtrl
= GetDlgItem16( hwnd
, id
);
1535 if (hwndCtrl
) return SendMessage16( hwndCtrl
, msg
, wParam
, lParam
);
1540 /*******************************************************************
1541 * SendDlgItemMessage32A (USER32.452)
1543 LRESULT WINAPI
SendDlgItemMessageA( HWND hwnd
, INT id
, UINT msg
,
1544 WPARAM wParam
, LPARAM lParam
)
1546 HWND hwndCtrl
= GetDlgItem( hwnd
, id
);
1547 if (hwndCtrl
) return SendMessageA( hwndCtrl
, msg
, wParam
, lParam
);
1552 /*******************************************************************
1553 * SendDlgItemMessage32W (USER32.453)
1555 LRESULT WINAPI
SendDlgItemMessageW( HWND hwnd
, INT id
, UINT msg
,
1556 WPARAM wParam
, LPARAM lParam
)
1558 HWND hwndCtrl
= GetDlgItem( hwnd
, id
);
1559 if (hwndCtrl
) return SendMessageW( hwndCtrl
, msg
, wParam
, lParam
);
1564 /*******************************************************************
1565 * SetDlgItemText16 (USER.92)
1567 void WINAPI
SetDlgItemText16( HWND16 hwnd
, INT16 id
, SEGPTR lpString
)
1569 SendDlgItemMessage16( hwnd
, id
, WM_SETTEXT
, 0, (LPARAM
)lpString
);
1573 /*******************************************************************
1574 * SetDlgItemText32A (USER32.478)
1576 BOOL WINAPI
SetDlgItemTextA( HWND hwnd
, INT id
, LPCSTR lpString
)
1578 return SendDlgItemMessageA( hwnd
, id
, WM_SETTEXT
, 0, (LPARAM
)lpString
);
1582 /*******************************************************************
1583 * SetDlgItemText32W (USER32.479)
1585 BOOL WINAPI
SetDlgItemTextW( HWND hwnd
, INT id
, LPCWSTR lpString
)
1587 return SendDlgItemMessageW( hwnd
, id
, WM_SETTEXT
, 0, (LPARAM
)lpString
);
1591 /***********************************************************************
1592 * GetDlgItemText16 (USER.93)
1594 INT16 WINAPI
GetDlgItemText16( HWND16 hwnd
, INT16 id
, SEGPTR str
, UINT16 len
)
1596 return (INT16
)SendDlgItemMessage16( hwnd
, id
, WM_GETTEXT
,
1601 /***********************************************************************
1602 * GetDlgItemText32A (USER32.237)
1604 INT WINAPI
GetDlgItemTextA( HWND hwnd
, INT id
, LPSTR str
, UINT len
)
1606 return (INT
)SendDlgItemMessageA( hwnd
, id
, WM_GETTEXT
,
1611 /***********************************************************************
1612 * GetDlgItemText32W (USER32.238)
1614 INT WINAPI
GetDlgItemTextW( HWND hwnd
, INT id
, LPWSTR str
, UINT len
)
1616 return (INT
)SendDlgItemMessageW( hwnd
, id
, WM_GETTEXT
,
1621 /*******************************************************************
1622 * SetDlgItemInt16 (USER.94)
1624 void WINAPI
SetDlgItemInt16( HWND16 hwnd
, INT16 id
, UINT16 value
, BOOL16 fSigned
)
1626 SetDlgItemInt( hwnd
, (UINT
)(UINT16
)id
, value
, fSigned
);
1630 /*******************************************************************
1631 * SetDlgItemInt32 (USER32.477)
1633 BOOL WINAPI
SetDlgItemInt( HWND hwnd
, INT id
, UINT value
,
1638 if (fSigned
) sprintf( str
, "%d", (INT
)value
);
1639 else sprintf( str
, "%u", value
);
1640 SendDlgItemMessageA( hwnd
, id
, WM_SETTEXT
, 0, (LPARAM
)str
);
1645 /***********************************************************************
1646 * GetDlgItemInt16 (USER.95)
1648 UINT16 WINAPI
GetDlgItemInt16( HWND16 hwnd
, INT16 id
, BOOL16
*translated
,
1654 if (translated
) *translated
= FALSE
;
1655 result
= GetDlgItemInt( hwnd
, (UINT
)(UINT16
)id
, &ok
, fSigned
);
1659 if (((INT
)result
< -32767) || ((INT
)result
> 32767)) return 0;
1663 if (result
> 65535) return 0;
1665 if (translated
) *translated
= TRUE
;
1666 return (UINT16
)result
;
1670 /***********************************************************************
1671 * GetDlgItemInt32 (USER32.236)
1673 UINT WINAPI
GetDlgItemInt( HWND hwnd
, INT id
, BOOL
*translated
,
1680 if (translated
) *translated
= FALSE
;
1681 if (!SendDlgItemMessageA(hwnd
, id
, WM_GETTEXT
, sizeof(str
), (LPARAM
)str
))
1685 result
= strtol( str
, &endptr
, 10 );
1686 if (!endptr
|| (endptr
== str
)) /* Conversion was unsuccessful */
1688 if (((result
== LONG_MIN
) || (result
== LONG_MAX
)) && (errno
==ERANGE
))
1693 result
= strtoul( str
, &endptr
, 10 );
1694 if (!endptr
|| (endptr
== str
)) /* Conversion was unsuccessful */
1696 if ((result
== ULONG_MAX
) && (errno
== ERANGE
)) return 0;
1698 if (translated
) *translated
= TRUE
;
1699 return (UINT
)result
;
1703 /***********************************************************************
1704 * CheckDlgButton16 (USER.97)
1706 BOOL16 WINAPI
CheckDlgButton16( HWND16 hwnd
, INT16 id
, UINT16 check
)
1708 SendDlgItemMessageA( hwnd
, id
, BM_SETCHECK
, check
, 0 );
1713 /***********************************************************************
1714 * CheckDlgButton32 (USER32.45)
1716 BOOL WINAPI
CheckDlgButton( HWND hwnd
, INT id
, UINT check
)
1718 SendDlgItemMessageA( hwnd
, id
, BM_SETCHECK
, check
, 0 );
1723 /***********************************************************************
1724 * IsDlgButtonChecked16 (USER.98)
1726 UINT16 WINAPI
IsDlgButtonChecked16( HWND16 hwnd
, UINT16 id
)
1728 return (UINT16
)SendDlgItemMessageA( hwnd
, id
, BM_GETCHECK
, 0, 0 );
1732 /***********************************************************************
1733 * IsDlgButtonChecked32 (USER32.344)
1735 UINT WINAPI
IsDlgButtonChecked( HWND hwnd
, UINT id
)
1737 return (UINT
)SendDlgItemMessageA( hwnd
, id
, BM_GETCHECK
, 0, 0 );
1741 /***********************************************************************
1742 * CheckRadioButton16 (USER.96)
1744 BOOL16 WINAPI
CheckRadioButton16( HWND16 hwndDlg
, UINT16 firstID
,
1745 UINT16 lastID
, UINT16 checkID
)
1747 return CheckRadioButton( hwndDlg
, firstID
, lastID
, checkID
);
1751 /***********************************************************************
1754 * Callback function used to check/uncheck radio buttons that fall
1755 * within a specific range of IDs.
1757 static BOOL CALLBACK
CheckRB(HWND hwndChild
, LPARAM lParam
)
1759 LONG lChildID
= GetWindowLongA(hwndChild
, GWL_ID
);
1760 RADIOGROUP
*lpRadioGroup
= (RADIOGROUP
*) lParam
;
1762 if ((lChildID
>= lpRadioGroup
->firstID
) &&
1763 (lChildID
<= lpRadioGroup
->lastID
))
1765 if (lChildID
== lpRadioGroup
->checkID
)
1767 SendMessageA(hwndChild
, BM_SETCHECK
, BST_CHECKED
, 0);
1771 SendMessageA(hwndChild
, BM_SETCHECK
, BST_UNCHECKED
, 0);
1779 /***********************************************************************
1780 * CheckRadioButton32 (USER32.48)
1782 BOOL WINAPI
CheckRadioButton( HWND hwndDlg
, UINT firstID
,
1783 UINT lastID
, UINT checkID
)
1785 RADIOGROUP radioGroup
;
1787 /* perform bounds checking for a radio button group */
1788 radioGroup
.firstID
= min(min(firstID
, lastID
), checkID
);
1789 radioGroup
.lastID
= max(max(firstID
, lastID
), checkID
);
1790 radioGroup
.checkID
= checkID
;
1792 return EnumChildWindows(hwndDlg
, (WNDENUMPROC
)CheckRB
,
1793 (LPARAM
)&radioGroup
);
1797 /***********************************************************************
1798 * GetDialogBaseUnits (USER.243) (USER32.233)
1800 DWORD WINAPI
GetDialogBaseUnits(void)
1802 return MAKELONG( xBaseUnit
, yBaseUnit
);
1806 /***********************************************************************
1807 * MapDialogRect16 (USER.103)
1809 void WINAPI
MapDialogRect16( HWND16 hwnd
, LPRECT16 rect
)
1811 DIALOGINFO
* dlgInfo
;
1812 WND
* wndPtr
= WIN_FindWndPtr( hwnd
);
1813 if (!wndPtr
) return;
1814 dlgInfo
= (DIALOGINFO
*)wndPtr
->wExtra
;
1815 rect
->left
= MulDiv(rect
->left
, dlgInfo
->xBaseUnit
, 4);
1816 rect
->right
= MulDiv(rect
->right
, dlgInfo
->xBaseUnit
, 4);
1817 rect
->top
= MulDiv(rect
->top
, dlgInfo
->yBaseUnit
, 8);
1818 rect
->bottom
= MulDiv(rect
->bottom
, dlgInfo
->yBaseUnit
, 8);
1819 WIN_ReleaseWndPtr(wndPtr
);
1823 /***********************************************************************
1824 * MapDialogRect32 (USER32.382)
1826 BOOL WINAPI
MapDialogRect( HWND hwnd
, LPRECT rect
)
1828 DIALOGINFO
* dlgInfo
;
1829 WND
* wndPtr
= WIN_FindWndPtr( hwnd
);
1830 if (!wndPtr
) return FALSE
;
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
);
1841 /***********************************************************************
1842 * GetNextDlgGroupItem16 (USER.227)
1844 HWND16 WINAPI
GetNextDlgGroupItem16( HWND16 hwndDlg
, HWND16 hwndCtrl
,
1847 return (HWND16
)GetNextDlgGroupItem( hwndDlg
, hwndCtrl
, fPrevious
);
1851 /***********************************************************************
1852 * GetNextDlgGroupItem32 (USER32.275)
1854 HWND WINAPI
GetNextDlgGroupItem( HWND hwndDlg
, HWND hwndCtrl
,
1865 /* if the hwndCtrl is the child of the control in the hwndDlg then the hwndDlg has to be the parent of the hwndCtrl */
1866 if(GetParent(hwndCtrl
) != hwndDlg
&& GetParent(GetParent(hwndCtrl
)) == hwndDlg
)
1867 hwndDlg
= GetParent(hwndCtrl
);
1870 if (!(pWndDlg
= WIN_FindWndPtr( hwndDlg
))) return 0;
1873 if (!(pWndCtrl
= WIN_FindWndPtr( hwndCtrl
)))
1878 /* Make sure hwndCtrl is a top-level child */
1879 while ((pWndCtrl
->dwStyle
& WS_CHILD
) && (pWndCtrl
->parent
!= pWndDlg
))
1880 WIN_UpdateWndPtr(&pWndCtrl
,pWndCtrl
->parent
);
1881 if (pWndCtrl
->parent
!= pWndDlg
)
1889 /* No ctrl specified -> start from the beginning */
1890 if (!(pWndCtrl
= WIN_LockWndPtr(pWndDlg
->child
)))
1896 while (pWndCtrl
->next
) WIN_UpdateWndPtr(&pWndCtrl
,pWndCtrl
->next
);
1899 pWndLast
= WIN_LockWndPtr(pWndCtrl
);
1900 pWnd
= WIN_LockWndPtr(pWndCtrl
->next
);
1904 if (!pWnd
|| (pWnd
->dwStyle
& WS_GROUP
))
1906 /* Wrap-around to the beginning of the group */
1909 WIN_UpdateWndPtr( &pWnd
, pWndDlg
->child
);
1910 for ( pWndTemp
= WIN_LockWndPtr( pWnd
);
1912 WIN_UpdateWndPtr( &pWndTemp
, pWndTemp
->next
) )
1914 if (pWndTemp
->dwStyle
& WS_GROUP
) WIN_UpdateWndPtr( &pWnd
, pWndTemp
);
1915 if (pWndTemp
== pWndCtrl
) break;
1917 WIN_ReleaseWndPtr( pWndTemp
);
1919 if (pWnd
== pWndCtrl
) break;
1920 if ((pWnd
->dwStyle
& WS_VISIBLE
) && !(pWnd
->dwStyle
& WS_DISABLED
))
1922 WIN_UpdateWndPtr(&pWndLast
,pWnd
);
1923 if (!fPrevious
) break;
1925 WIN_UpdateWndPtr(&pWnd
,pWnd
->next
);
1927 retvalue
= pWndLast
->hwndSelf
;
1929 WIN_ReleaseWndPtr(pWndLast
);
1930 WIN_ReleaseWndPtr(pWnd
);
1932 WIN_ReleaseWndPtr(pWndCtrl
);
1933 WIN_ReleaseWndPtr(pWndDlg
);
1939 /***********************************************************************
1940 * GetNextDlgTabItem16 (USER.228)
1942 HWND16 WINAPI
GetNextDlgTabItem16( HWND16 hwndDlg
, HWND16 hwndCtrl
,
1945 return (HWND16
)GetNextDlgTabItem( hwndDlg
, hwndCtrl
, fPrevious
);
1948 /***********************************************************************
1949 * DIALOG_GetNextTabItem
1951 * Helper for GetNextDlgTabItem
1953 static HWND
DIALOG_GetNextTabItem( HWND hwndMain
, HWND hwndDlg
, HWND hwndCtrl
, BOOL fPrevious
)
1957 UINT wndSearch
= fPrevious
? GW_HWNDPREV
: GW_HWNDNEXT
;
1959 HWND hChildFirst
= 0;
1963 hChildFirst
= GetWindow(hwndDlg
,GW_CHILD
);
1964 if(fPrevious
) hChildFirst
= GetWindow(hChildFirst
,GW_HWNDLAST
);
1968 HWND hParent
= GetParent(hwndCtrl
);
1969 BOOL bValid
= FALSE
;
1972 if(hParent
== hwndMain
)
1977 hParent
= GetParent(hParent
);
1981 hChildFirst
= GetWindow(hwndCtrl
,wndSearch
);
1984 if(GetParent(hwndCtrl
) != hwndMain
)
1985 hChildFirst
= GetWindow(GetParent(hwndCtrl
),wndSearch
);
1989 hChildFirst
= GetWindow(hwndCtrl
,GW_HWNDLAST
);
1991 hChildFirst
= GetWindow(hwndCtrl
,GW_HWNDFIRST
);
2001 dsStyle
= GetWindowLongA(hChildFirst
,GWL_STYLE
);
2002 exStyle
= GetWindowLongA(hChildFirst
,GWL_EXSTYLE
);
2003 if( (dsStyle
& DS_CONTROL
|| exStyle
& WS_EX_CONTROLPARENT
) && (dsStyle
& WS_VISIBLE
) && !(dsStyle
& WS_DISABLED
))
2008 else if( (dsStyle
& WS_TABSTOP
) && (dsStyle
& WS_VISIBLE
) && !(dsStyle
& WS_DISABLED
))
2010 hChildFirst
= GetWindow(hChildFirst
,wndSearch
);
2015 retWnd
= DIALOG_GetNextTabItem(hwndMain
,hChildFirst
,(HWND
)NULL
,fPrevious
);
2017 retWnd
= hChildFirst
;
2020 hChildFirst
= GetWindow(hChildFirst
,wndSearch
);
2022 if(!retWnd
&& hwndCtrl
)
2024 HWND hParent
= GetParent(hwndCtrl
);
2027 if(hParent
== hwndMain
) break;
2028 retWnd
= DIALOG_GetNextTabItem(hwndMain
,GetParent(hParent
),hParent
,fPrevious
);
2030 hParent
= GetParent(hParent
);
2033 retWnd
= DIALOG_GetNextTabItem(hwndMain
,hwndMain
,(HWND
)NULL
,fPrevious
);
2038 /***********************************************************************
2039 * GetNextDlgTabItem32 (USER32.276)
2041 HWND WINAPI
GetNextDlgTabItem( HWND hwndDlg
, HWND hwndCtrl
,
2044 return DIALOG_GetNextTabItem(hwndDlg
,hwndDlg
,hwndCtrl
,fPrevious
);
2047 /**********************************************************************
2048 * DIALOG_DlgDirSelect
2050 * Helper function for DlgDirSelect*
2052 static BOOL
DIALOG_DlgDirSelect( HWND hwnd
, LPSTR str
, INT len
,
2053 INT id
, BOOL win32
, BOOL unicode
,
2059 HWND listbox
= GetDlgItem( hwnd
, id
);
2061 TRACE("%04x '%s' %d\n", hwnd
, str
, id
);
2062 if (!listbox
) return FALSE
;
2065 item
= SendMessageA(listbox
, combo
? CB_GETCURSEL
2066 : LB_GETCURSEL
, 0, 0 );
2067 if (item
== LB_ERR
) return FALSE
;
2068 size
= SendMessageA(listbox
, combo
? CB_GETLBTEXTLEN
2069 : LB_GETTEXTLEN
, 0, 0 );
2070 if (size
== LB_ERR
) return FALSE
;
2074 item
= SendMessageA(listbox
, combo
? CB_GETCURSEL16
2075 : LB_GETCURSEL16
, 0, 0 );
2076 if (item
== LB_ERR
) return FALSE
;
2077 size
= SendMessageA(listbox
, combo
? CB_GETLBTEXTLEN16
2078 : LB_GETTEXTLEN16
, 0, 0 );
2079 if (size
== LB_ERR
) return FALSE
;
2082 if (!(buffer
= SEGPTR_ALLOC( size
+1 ))) return FALSE
;
2085 SendMessageA( listbox
, combo
? CB_GETLBTEXT
: LB_GETTEXT
,
2086 item
, (LPARAM
)buffer
);
2088 SendMessage16( listbox
, combo
? CB_GETLBTEXT16
: LB_GETTEXT16
,
2089 item
, (LPARAM
)SEGPTR_GET(buffer
) );
2091 if ((ret
= (buffer
[0] == '['))) /* drive or directory */
2093 if (buffer
[1] == '-') /* drive */
2101 buffer
[strlen(buffer
)-1] = '\\';
2107 if (unicode
) lstrcpynAtoW( (LPWSTR
)str
, ptr
, len
);
2108 else lstrcpynA( str
, ptr
, len
);
2109 SEGPTR_FREE( buffer
);
2110 TRACE("Returning %d '%s'\n", ret
, str
);
2115 /**********************************************************************
2118 * Helper function for DlgDirList*
2120 static INT
DIALOG_DlgDirList( HWND hDlg
, LPSTR spec
, INT idLBox
,
2121 INT idStatic
, UINT attrib
, BOOL combo
)
2125 LPSTR orig_spec
= spec
;
2127 #define SENDMSG(msg,wparam,lparam) \
2128 ((attrib & DDL_POSTMSGS) ? PostMessageA( hwnd, msg, wparam, lparam ) \
2129 : SendMessageA( hwnd, msg, wparam, lparam ))
2131 TRACE("%04x '%s' %d %d %04x\n",
2132 hDlg
, spec
? spec
: "NULL", idLBox
, idStatic
, attrib
);
2134 if (spec
&& spec
[0] && (spec
[1] == ':'))
2136 drive
= toupper( spec
[0] ) - 'A';
2138 if (!DRIVE_SetCurrentDrive( drive
)) return FALSE
;
2140 else drive
= DRIVE_GetCurrentDrive();
2142 /* If the path exists and is a directory, chdir to it */
2143 if (!spec
|| !spec
[0] || DRIVE_Chdir( drive
, spec
)) spec
= "*.*";
2148 if ((p2
= strrchr( p
, '\\' ))) p
= p2
;
2149 if ((p2
= strrchr( p
, '/' ))) p
= p2
;
2154 if (!DRIVE_Chdir( drive
, spec
))
2156 *p
= sep
; /* Restore the original spec */
2163 TRACE("path=%c:\\%s mask=%s\n",
2164 'A' + drive
, DRIVE_GetDosCwd(drive
), spec
);
2166 if (idLBox
&& ((hwnd
= GetDlgItem( hDlg
, idLBox
)) != 0))
2168 SENDMSG( combo
? CB_RESETCONTENT
: LB_RESETCONTENT
, 0, 0 );
2169 if (attrib
& DDL_DIRECTORY
)
2171 if (!(attrib
& DDL_EXCLUSIVE
))
2173 if (SENDMSG( combo
? CB_DIR
: LB_DIR
,
2174 attrib
& ~(DDL_DIRECTORY
| DDL_DRIVES
),
2175 (LPARAM
)spec
) == LB_ERR
)
2178 if (SENDMSG( combo
? CB_DIR
: LB_DIR
,
2179 (attrib
& (DDL_DIRECTORY
| DDL_DRIVES
)) | DDL_EXCLUSIVE
,
2180 (LPARAM
)"*.*" ) == LB_ERR
)
2185 if (SENDMSG( combo
? CB_DIR
: LB_DIR
, attrib
,
2186 (LPARAM
)spec
) == LB_ERR
)
2191 if (idStatic
&& ((hwnd
= GetDlgItem( hDlg
, idStatic
)) != 0))
2194 int drive
= DRIVE_GetCurrentDrive();
2195 strcpy( temp
, "A:\\" );
2197 lstrcpynA( temp
+ 3, DRIVE_GetDosCwd(drive
), sizeof(temp
)-3 );
2199 /* Can't use PostMessage() here, because the string is on the stack */
2200 SetDlgItemTextA( hDlg
, idStatic
, temp
);
2203 if (orig_spec
&& (spec
!= orig_spec
))
2205 /* Update the original file spec */
2207 while ((*orig_spec
++ = *p
++));
2215 /**********************************************************************
2216 * DIALOG_DlgDirListW
2218 * Helper function for DlgDirList*32W
2220 static INT
DIALOG_DlgDirListW( HWND hDlg
, LPWSTR spec
, INT idLBox
,
2221 INT idStatic
, UINT attrib
, BOOL combo
)
2225 LPSTR specA
= HEAP_strdupWtoA( GetProcessHeap(), 0, spec
);
2226 INT ret
= DIALOG_DlgDirList( hDlg
, specA
, idLBox
, idStatic
,
2228 lstrcpyAtoW( spec
, specA
);
2229 HeapFree( GetProcessHeap(), 0, specA
);
2232 return DIALOG_DlgDirList( hDlg
, NULL
, idLBox
, idStatic
, attrib
, combo
);
2236 /**********************************************************************
2237 * DlgDirSelect (USER.99)
2239 BOOL16 WINAPI
DlgDirSelect16( HWND16 hwnd
, LPSTR str
, INT16 id
)
2241 return DlgDirSelectEx16( hwnd
, str
, 128, id
);
2245 /**********************************************************************
2246 * DlgDirSelectComboBox (USER.194)
2248 BOOL16 WINAPI
DlgDirSelectComboBox16( HWND16 hwnd
, LPSTR str
, INT16 id
)
2250 return DlgDirSelectComboBoxEx16( hwnd
, str
, 128, id
);
2254 /**********************************************************************
2255 * DlgDirSelectEx16 (USER.422)
2257 BOOL16 WINAPI
DlgDirSelectEx16( HWND16 hwnd
, LPSTR str
, INT16 len
, INT16 id
)
2259 return DIALOG_DlgDirSelect( hwnd
, str
, len
, id
, FALSE
, FALSE
, FALSE
);
2263 /**********************************************************************
2264 * DlgDirSelectEx32A (USER32.149)
2266 BOOL WINAPI
DlgDirSelectExA( HWND hwnd
, LPSTR str
, INT len
, INT id
)
2268 return DIALOG_DlgDirSelect( hwnd
, str
, len
, id
, TRUE
, FALSE
, FALSE
);
2272 /**********************************************************************
2273 * DlgDirSelectEx32W (USER32.150)
2275 BOOL WINAPI
DlgDirSelectExW( HWND hwnd
, LPWSTR str
, INT len
, INT id
)
2277 return DIALOG_DlgDirSelect( hwnd
, (LPSTR
)str
, len
, id
, TRUE
, TRUE
, FALSE
);
2281 /**********************************************************************
2282 * DlgDirSelectComboBoxEx16 (USER.423)
2284 BOOL16 WINAPI
DlgDirSelectComboBoxEx16( HWND16 hwnd
, LPSTR str
, INT16 len
,
2287 return DIALOG_DlgDirSelect( hwnd
, str
, len
, id
, FALSE
, FALSE
, TRUE
);
2291 /**********************************************************************
2292 * DlgDirSelectComboBoxEx32A (USER32.147)
2294 BOOL WINAPI
DlgDirSelectComboBoxExA( HWND hwnd
, LPSTR str
, INT len
,
2297 return DIALOG_DlgDirSelect( hwnd
, str
, len
, id
, TRUE
, FALSE
, TRUE
);
2301 /**********************************************************************
2302 * DlgDirSelectComboBoxEx32W (USER32.148)
2304 BOOL WINAPI
DlgDirSelectComboBoxExW( HWND hwnd
, LPWSTR str
, INT len
,
2307 return DIALOG_DlgDirSelect( hwnd
, (LPSTR
)str
, len
, id
, TRUE
, TRUE
, TRUE
);
2311 /**********************************************************************
2312 * DlgDirList16 (USER.100)
2314 INT16 WINAPI
DlgDirList16( HWND16 hDlg
, LPSTR spec
, INT16 idLBox
,
2315 INT16 idStatic
, UINT16 attrib
)
2317 return DIALOG_DlgDirList( hDlg
, spec
, idLBox
, idStatic
, attrib
, FALSE
);
2321 /**********************************************************************
2322 * DlgDirList32A (USER32.143)
2324 INT WINAPI
DlgDirListA( HWND hDlg
, LPSTR spec
, INT idLBox
,
2325 INT idStatic
, UINT attrib
)
2327 return DIALOG_DlgDirList( hDlg
, spec
, idLBox
, idStatic
, attrib
, FALSE
);
2331 /**********************************************************************
2332 * DlgDirList32W (USER32.146)
2334 INT WINAPI
DlgDirListW( HWND hDlg
, LPWSTR spec
, INT idLBox
,
2335 INT idStatic
, UINT attrib
)
2337 return DIALOG_DlgDirListW( hDlg
, spec
, idLBox
, idStatic
, attrib
, FALSE
);
2341 /**********************************************************************
2342 * DlgDirListComboBox16 (USER.195)
2344 INT16 WINAPI
DlgDirListComboBox16( HWND16 hDlg
, LPSTR spec
, INT16 idCBox
,
2345 INT16 idStatic
, UINT16 attrib
)
2347 return DIALOG_DlgDirList( hDlg
, spec
, idCBox
, idStatic
, attrib
, TRUE
);
2351 /**********************************************************************
2352 * DlgDirListComboBox32A (USER32.144)
2354 INT WINAPI
DlgDirListComboBoxA( HWND hDlg
, LPSTR spec
, INT idCBox
,
2355 INT idStatic
, UINT attrib
)
2357 return DIALOG_DlgDirList( hDlg
, spec
, idCBox
, idStatic
, attrib
, TRUE
);
2361 /**********************************************************************
2362 * DlgDirListComboBox32W (USER32.145)
2364 INT WINAPI
DlgDirListComboBoxW( HWND hDlg
, LPWSTR spec
, INT idCBox
,
2365 INT idStatic
, UINT attrib
)
2367 return DIALOG_DlgDirListW( hDlg
, spec
, idCBox
, idStatic
, attrib
, TRUE
);