4 * Copyright 1993, 1994, 1996 Alexandre Julliard
20 #include "wine/winuser16.h"
21 #include "wine/winbase16.h"
22 #include "wine/unicode.h"
23 #include "wine/port.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;
82 /*********************************************************************
83 * dialog class descriptor
85 const struct builtin_class_descr DIALOG_builtin_class
=
87 DIALOG_CLASS_ATOM
, /* name */
88 CS_GLOBALCLASS
| CS_SAVEBITS
, /* style */
89 DefDlgProcA
, /* procA */
90 DefDlgProcW
, /* procW */
91 DLGWINDOWEXTRA
, /* extra */
92 IDC_ARROWA
, /* cursor */
97 /***********************************************************************
100 * Helper function for modal dialogs to enable again the
101 * owner of the dialog box.
103 void DIALOG_EnableOwner( HWND hOwner
)
105 /* Owner must be a top-level window */
107 hOwner
= GetAncestor( hOwner
, GA_ROOT
);
109 EnableWindow( hOwner
, TRUE
);
113 /***********************************************************************
114 * DIALOG_DisableOwner
116 * Helper function for modal dialogs to disable the
117 * owner of the dialog box. Returns TRUE if owner was enabled.
119 BOOL
DIALOG_DisableOwner( HWND hOwner
)
121 /* Owner must be a top-level window */
123 hOwner
= GetAncestor( hOwner
, GA_ROOT
);
124 if (!hOwner
) return FALSE
;
125 if (IsWindowEnabled( hOwner
))
127 EnableWindow( hOwner
, FALSE
);
134 /***********************************************************************
135 * DIALOG_GetCharSizeFromDC
138 * Calculates the *true* average size of English characters in the
139 * specified font as oppposed to the one returned by GetTextMetrics.
141 * Latest: the X font driver will now compute a proper average width
142 * so this code can be removed
144 static BOOL
DIALOG_GetCharSizeFromDC( HDC hDC
, HFONT hFont
, SIZE
* pSize
)
146 BOOL Success
= FALSE
;
148 pSize
->cx
= xBaseUnit
;
149 pSize
->cy
= yBaseUnit
;
152 /* select the font */
154 memset(&tm
,0,sizeof(tm
));
155 if (hFont
) hFontPrev
= SelectFont(hDC
,hFont
);
156 if (GetTextMetricsA(hDC
,&tm
))
158 pSize
->cx
= tm
.tmAveCharWidth
;
159 pSize
->cy
= tm
.tmHeight
;
161 /* if variable width font */
162 if (tm
.tmPitchAndFamily
& TMPF_FIXED_PITCH
)
165 const char* szAvgChars
= "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
167 /* Calculate a true average as opposed to the one returned
168 * by tmAveCharWidth. This works better when dealing with
169 * proportional spaced fonts and (more important) that's
170 * how Microsoft's dialog creation code calculates the size
173 if (GetTextExtentPointA(hDC
,szAvgChars
,sizeof(szAvgChars
),&total
))
176 pSize
->cx
= ((2*total
.cx
/sizeof(szAvgChars
)) + 1)/2;
184 /* Use the text metrics */
185 TRACE("Using tm: %ldx%ld (dlg: %ld x %ld) (%s)\n",
186 tm
.tmAveCharWidth
, tm
.tmHeight
, pSize
->cx
, pSize
->cy
,
187 tm
.tmPitchAndFamily
& TMPF_FIXED_PITCH
? "variable" : "fixed");
188 pSize
->cx
= tm
.tmAveCharWidth
;
189 pSize
->cy
= tm
.tmHeight
;
191 /* select the original font */
192 if (hFontPrev
) SelectFont(hDC
,hFontPrev
);
197 /***********************************************************************
200 * A convenient variant of DIALOG_GetCharSizeFromDC.
202 static BOOL
DIALOG_GetCharSize( HFONT hFont
, SIZE
* pSize
)
205 BOOL Success
= DIALOG_GetCharSizeFromDC( hDC
, hFont
, pSize
);
210 /***********************************************************************
213 * Initialisation of the dialog manager.
215 BOOL
DIALOG_Init(void)
220 /* Calculate the dialog base units */
222 if (!(hdc
= CreateDCA( "DISPLAY", NULL
, NULL
, NULL
)))
224 ERR("Could not create Display DC\n");
228 if (!DIALOG_GetCharSizeFromDC( hdc
, 0, &size
))
231 ERR("Could not initialize base dialog units\n");
239 TRACE("base units = %d,%d\n", xBaseUnit
, yBaseUnit
);
244 /***********************************************************************
245 * DIALOG_GetControl16
247 * Return the class and text of the control pointed to by ptr,
248 * fill the header structure and return a pointer to the next control.
250 static LPCSTR
DIALOG_GetControl16( LPCSTR p
, DLG_CONTROL_INFO
*info
)
252 static char buffer
[10];
255 info
->x
= GET_WORD(p
); p
+= sizeof(WORD
);
256 info
->y
= GET_WORD(p
); p
+= sizeof(WORD
);
257 info
->cx
= GET_WORD(p
); p
+= sizeof(WORD
);
258 info
->cy
= GET_WORD(p
); p
+= sizeof(WORD
);
259 info
->id
= GET_WORD(p
); p
+= sizeof(WORD
);
260 info
->style
= GET_DWORD(p
); p
+= sizeof(DWORD
);
267 case 0x80: strcpy( buffer
, "BUTTON" ); break;
268 case 0x81: strcpy( buffer
, "EDIT" ); break;
269 case 0x82: strcpy( buffer
, "STATIC" ); break;
270 case 0x83: strcpy( buffer
, "LISTBOX" ); break;
271 case 0x84: strcpy( buffer
, "SCROLLBAR" ); break;
272 case 0x85: strcpy( buffer
, "COMBOBOX" ); break;
273 default: buffer
[0] = '\0'; break;
275 info
->className
= buffer
;
284 int_id
= ((BYTE
)*p
== 0xff);
287 /* Integer id, not documented (?). Only works for SS_ICON controls */
288 info
->windowName
= (LPCSTR
)(UINT
)GET_WORD(p
+1);
293 info
->windowName
= p
;
299 /* Additional CTLDATA available for this control. */
300 info
->data
= SEGPTR_ALLOC(*p
);
301 memcpy( info
->data
, p
+ 1, *p
);
303 else info
->data
= NULL
;
308 TRACE(" %s %04x %d, %d, %d, %d, %d, %08lx, %08lx\n",
309 info
->className
, LOWORD(info
->windowName
),
310 info
->id
, info
->x
, info
->y
, info
->cx
, info
->cy
,
311 info
->style
, (DWORD
)SEGPTR_GET(info
->data
) );
313 TRACE(" %s '%s' %d, %d, %d, %d, %d, %08lx, %08lx\n",
314 info
->className
, info
->windowName
,
315 info
->id
, info
->x
, info
->y
, info
->cx
, info
->cy
,
316 info
->style
, (DWORD
)SEGPTR_GET(info
->data
) );
322 /***********************************************************************
323 * DIALOG_GetControl32
325 * Return the class and text of the control pointed to by ptr,
326 * fill the header structure and return a pointer to the next control.
328 static const WORD
*DIALOG_GetControl32( const WORD
*p
, DLG_CONTROL_INFO
*info
,
333 info
->helpId
= GET_DWORD(p
); p
+= 2;
334 info
->exStyle
= GET_DWORD(p
); p
+= 2;
335 info
->style
= GET_DWORD(p
); p
+= 2;
340 info
->style
= GET_DWORD(p
); p
+= 2;
341 info
->exStyle
= GET_DWORD(p
); p
+= 2;
343 info
->x
= GET_WORD(p
); p
++;
344 info
->y
= GET_WORD(p
); p
++;
345 info
->cx
= GET_WORD(p
); p
++;
346 info
->cy
= GET_WORD(p
); p
++;
350 /* id is a DWORD for DIALOGEX */
351 info
->id
= GET_DWORD(p
);
356 info
->id
= GET_WORD(p
);
360 if (GET_WORD(p
) == 0xffff)
362 static const WCHAR class_names
[6][10] =
364 { 'B','u','t','t','o','n', }, /* 0x80 */
365 { 'E','d','i','t', }, /* 0x81 */
366 { 'S','t','a','t','i','c', }, /* 0x82 */
367 { 'L','i','s','t','B','o','x', }, /* 0x83 */
368 { 'S','c','r','o','l','l','B','a','r', }, /* 0x84 */
369 { 'C','o','m','b','o','B','o','x', } /* 0x85 */
371 WORD id
= GET_WORD(p
+1);
372 if ((id
>= 0x80) && (id
<= 0x85))
373 info
->className
= (LPCSTR
)class_names
[id
- 0x80];
376 info
->className
= NULL
;
377 ERR("Unknown built-in class id %04x\n", id
);
383 info
->className
= (LPCSTR
)p
;
384 p
+= strlenW( (LPCWSTR
)p
) + 1;
387 if (GET_WORD(p
) == 0xffff) /* Is it an integer id? */
389 info
->windowName
= (LPCSTR
)(UINT
)GET_WORD(p
+ 1);
394 info
->windowName
= (LPCSTR
)p
;
395 p
+= strlenW( (LPCWSTR
)p
) + 1;
398 TRACE(" %s %s %d, %d, %d, %d, %d, %08lx, %08lx, %08lx\n",
399 debugstr_w( (LPCWSTR
)info
->className
),
400 debugres_w( (LPCWSTR
)info
->windowName
),
401 info
->id
, info
->x
, info
->y
, info
->cx
, info
->cy
,
402 info
->style
, info
->exStyle
, info
->helpId
);
406 if (TRACE_ON(dialog
))
408 WORD i
, count
= GET_WORD(p
) / sizeof(WORD
);
411 for (i
= 0; i
< count
; i
++) DPRINTF( "%04x,", GET_WORD(p
+i
+1) );
415 info
->data
= (LPVOID
)(p
+ 1);
416 p
+= GET_WORD(p
) / sizeof(WORD
);
418 else info
->data
= NULL
;
421 /* Next control is on dword boundary */
422 return (const WORD
*)((((int)p
) + 3) & ~3);
426 /***********************************************************************
427 * DIALOG_CreateControls
429 * Create the control windows for a dialog.
431 static BOOL
DIALOG_CreateControls( WND
*pWnd
, LPCSTR
template,
432 const DLG_TEMPLATE
*dlgTemplate
,
433 HINSTANCE hInst
, BOOL win32
)
435 DIALOGINFO
*dlgInfo
= (DIALOGINFO
*)pWnd
->wExtra
;
436 DLG_CONTROL_INFO info
;
437 HWND hwndCtrl
, hwndDefButton
= 0;
438 INT items
= dlgTemplate
->nbItems
;
445 HINSTANCE16 instance
;
446 template = DIALOG_GetControl16( template, &info
);
447 if (HIWORD(info
.className
) && !strcmp( info
.className
, "EDIT") &&
448 ((pWnd
->dwStyle
& DS_LOCALEDIT
) != DS_LOCALEDIT
))
450 if (!dlgInfo
->hDialogHeap
)
452 dlgInfo
->hDialogHeap
= GlobalAlloc16(GMEM_FIXED
, 0x10000);
453 if (!dlgInfo
->hDialogHeap
)
455 ERR("Insufficient memory to create heap for edit control\n" );
458 LocalInit16(dlgInfo
->hDialogHeap
, 0, 0xffff);
460 instance
= dlgInfo
->hDialogHeap
;
462 else instance
= (HINSTANCE16
)hInst
;
464 hwndCtrl
= CreateWindowEx16( info
.exStyle
| WS_EX_NOPARENTNOTIFY
,
465 info
.className
, info
.windowName
,
466 info
.style
| WS_CHILD
,
467 MulDiv(info
.x
, dlgInfo
->xBaseUnit
, 4),
468 MulDiv(info
.y
, dlgInfo
->yBaseUnit
, 8),
469 MulDiv(info
.cx
, dlgInfo
->xBaseUnit
, 4),
470 MulDiv(info
.cy
, dlgInfo
->yBaseUnit
, 8),
471 pWnd
->hwndSelf
, (HMENU16
)info
.id
,
472 instance
, (LPVOID
)SEGPTR_GET(info
.data
) );
474 if (info
.data
) SEGPTR_FREE(info
.data
);
478 template = (LPCSTR
)DIALOG_GetControl32( (WORD
*)template, &info
,
479 dlgTemplate
->dialogEx
);
481 if (info
.style
& WS_BORDER
)
483 info
.style
&= ~WS_BORDER
;
484 info
.exStyle
|= WS_EX_CLIENTEDGE
;
486 hwndCtrl
= CreateWindowExW( info
.exStyle
| WS_EX_NOPARENTNOTIFY
,
487 (LPCWSTR
)info
.className
,
488 (LPCWSTR
)info
.windowName
,
489 info
.style
| WS_CHILD
,
490 MulDiv(info
.x
, dlgInfo
->xBaseUnit
, 4),
491 MulDiv(info
.y
, dlgInfo
->yBaseUnit
, 8),
492 MulDiv(info
.cx
, dlgInfo
->xBaseUnit
, 4),
493 MulDiv(info
.cy
, dlgInfo
->yBaseUnit
, 8),
494 pWnd
->hwndSelf
, (HMENU
)info
.id
,
497 if (!hwndCtrl
) return FALSE
;
499 /* Send initialisation messages to the control */
500 if (dlgInfo
->hUserFont
) SendMessageA( hwndCtrl
, WM_SETFONT
,
501 (WPARAM
)dlgInfo
->hUserFont
, 0 );
502 if (SendMessageA(hwndCtrl
, WM_GETDLGCODE
, 0, 0) & DLGC_DEFPUSHBUTTON
)
504 /* If there's already a default push-button, set it back */
505 /* to normal and use this one instead. */
507 SendMessageA( hwndDefButton
, BM_SETSTYLE
,
508 BS_PUSHBUTTON
,FALSE
);
509 hwndDefButton
= hwndCtrl
;
510 dlgInfo
->idResult
= GetWindowWord( hwndCtrl
, GWW_ID
);
518 /***********************************************************************
519 * DIALOG_ParseTemplate16
521 * Fill a DLG_TEMPLATE structure from the dialog template, and return
522 * a pointer to the first control.
524 static LPCSTR
DIALOG_ParseTemplate16( LPCSTR p
, DLG_TEMPLATE
* result
)
526 result
->style
= GET_DWORD(p
); p
+= sizeof(DWORD
);
528 result
->nbItems
= (unsigned char) *p
++;
529 result
->x
= GET_WORD(p
); p
+= sizeof(WORD
);
530 result
->y
= GET_WORD(p
); p
+= sizeof(WORD
);
531 result
->cx
= GET_WORD(p
); p
+= sizeof(WORD
);
532 result
->cy
= GET_WORD(p
); p
+= sizeof(WORD
);
533 TRACE("DIALOG %d, %d, %d, %d\n",
534 result
->x
, result
->y
, result
->cx
, result
->cy
);
535 TRACE(" STYLE %08lx\n", result
->style
);
537 /* Get the menu name */
542 result
->menuName
= 0;
546 result
->menuName
= (LPCSTR
)(UINT
)GET_WORD( p
+ 1 );
548 TRACE(" MENU %04x\n", LOWORD(result
->menuName
) );
551 result
->menuName
= p
;
552 TRACE(" MENU '%s'\n", p
);
557 /* Get the class name */
561 result
->className
= p
;
562 TRACE(" CLASS '%s'\n", result
->className
);
564 else result
->className
= DIALOG_CLASS_ATOM
;
567 /* Get the window caption */
571 TRACE(" CAPTION '%s'\n", result
->caption
);
573 /* Get the font name */
575 if (result
->style
& DS_SETFONT
)
577 result
->pointSize
= GET_WORD(p
);
579 result
->faceName
= p
;
581 TRACE(" FONT %d,'%s'\n",
582 result
->pointSize
, result
->faceName
);
588 /***********************************************************************
589 * DIALOG_ParseTemplate32
591 * Fill a DLG_TEMPLATE structure from the dialog template, and return
592 * a pointer to the first control.
594 static LPCSTR
DIALOG_ParseTemplate32( LPCSTR
template, DLG_TEMPLATE
* result
)
596 const WORD
*p
= (const WORD
*)template;
598 result
->style
= GET_DWORD(p
); p
+= 2;
599 if (result
->style
== 0xffff0001) /* DIALOGEX resource */
601 result
->dialogEx
= TRUE
;
602 result
->helpId
= GET_DWORD(p
); p
+= 2;
603 result
->exStyle
= GET_DWORD(p
); p
+= 2;
604 result
->style
= GET_DWORD(p
); p
+= 2;
608 result
->dialogEx
= FALSE
;
610 result
->exStyle
= GET_DWORD(p
); p
+= 2;
612 result
->nbItems
= GET_WORD(p
); p
++;
613 result
->x
= GET_WORD(p
); p
++;
614 result
->y
= GET_WORD(p
); p
++;
615 result
->cx
= GET_WORD(p
); p
++;
616 result
->cy
= GET_WORD(p
); p
++;
617 TRACE("DIALOG%s %d, %d, %d, %d, %ld\n",
618 result
->dialogEx
? "EX" : "", result
->x
, result
->y
,
619 result
->cx
, result
->cy
, result
->helpId
);
620 TRACE(" STYLE 0x%08lx\n", result
->style
);
621 TRACE(" EXSTYLE 0x%08lx\n", result
->exStyle
);
623 /* Get the menu name */
628 result
->menuName
= NULL
;
632 result
->menuName
= (LPCSTR
)(UINT
)GET_WORD( p
+ 1 );
634 TRACE(" MENU %04x\n", LOWORD(result
->menuName
) );
637 result
->menuName
= (LPCSTR
)p
;
638 TRACE(" MENU %s\n", debugstr_w( (LPCWSTR
)p
));
639 p
+= strlenW( (LPCWSTR
)p
) + 1;
643 /* Get the class name */
648 result
->className
= DIALOG_CLASS_ATOM
;
652 result
->className
= (LPCSTR
)(UINT
)GET_WORD( p
+ 1 );
654 TRACE(" CLASS %04x\n", LOWORD(result
->className
) );
657 result
->className
= (LPCSTR
)p
;
658 TRACE(" CLASS %s\n", debugstr_w( (LPCWSTR
)p
));
659 p
+= strlenW( (LPCWSTR
)p
) + 1;
663 /* Get the window caption */
665 result
->caption
= (LPCSTR
)p
;
666 p
+= strlenW( (LPCWSTR
)p
) + 1;
667 TRACE(" CAPTION %s\n", debugstr_w( (LPCWSTR
)result
->caption
) );
669 /* Get the font name */
671 if (result
->style
& DS_SETFONT
)
673 result
->pointSize
= GET_WORD(p
);
675 if (result
->dialogEx
)
677 result
->weight
= GET_WORD(p
); p
++;
678 result
->italic
= LOBYTE(GET_WORD(p
)); p
++;
682 result
->weight
= FW_DONTCARE
;
683 result
->italic
= FALSE
;
685 result
->faceName
= (LPCSTR
)p
;
686 p
+= strlenW( (LPCWSTR
)p
) + 1;
687 TRACE(" FONT %d, %s, %d, %s\n",
688 result
->pointSize
, debugstr_w( (LPCWSTR
)result
->faceName
),
689 result
->weight
, result
->italic
? "TRUE" : "FALSE" );
692 /* First control is on dword boundary */
693 return (LPCSTR
)((((int)p
) + 3) & ~3);
697 /***********************************************************************
698 * DIALOG_CreateIndirect
699 * Creates a dialog box window
701 * modal = TRUE if we are called from a modal dialog box.
702 * (it's more compatible to do it here, as under Windows the owner
703 * is never disabled if the dialog fails because of an invalid template)
705 static HWND
DIALOG_CreateIndirect( HINSTANCE hInst
, LPCSTR dlgTemplate
,
706 BOOL win32Template
, HWND owner
,
707 DLGPROC16 dlgProc
, LPARAM param
,
708 WINDOWPROCTYPE procType
, BOOL modal
)
715 DLG_TEMPLATE
template;
716 DIALOGINFO
* dlgInfo
;
717 WORD xUnit
= xBaseUnit
;
718 WORD yUnit
= yBaseUnit
;
719 BOOL ownerEnabled
= TRUE
;
721 /* Parse dialog template */
723 if (!dlgTemplate
) return 0;
725 dlgTemplate
= DIALOG_ParseTemplate32( dlgTemplate
, &template );
727 dlgTemplate
= DIALOG_ParseTemplate16( dlgTemplate
, &template );
731 if (template.menuName
)
733 if (!win32Template
) hMenu
= LoadMenu16( hInst
, template.menuName
);
734 else hMenu
= LoadMenuW( hInst
, (LPCWSTR
)template.menuName
);
737 /* Create custom font if needed */
739 if (template.style
& DS_SETFONT
)
741 /* The font height must be negative as it is a point size */
742 /* and must be converted to pixels first */
743 /* (see CreateFont() documentation in the Windows SDK). */
746 if (((short)template.pointSize
) < 0)
747 pixels
= -((short)template.pointSize
);
751 pixels
= template.pointSize
* GetDeviceCaps(dc
, LOGPIXELSY
)/72;
755 hFont
= CreateFontW( -pixels
, 0, 0, 0, template.weight
,
756 template.italic
, FALSE
, FALSE
,
757 DEFAULT_CHARSET
, 0, 0,
758 PROOF_QUALITY
, FF_DONTCARE
,
759 (LPCWSTR
)template.faceName
);
761 hFont
= CreateFontA( -pixels
, 0, 0, 0, FW_DONTCARE
,
763 DEFAULT_CHARSET
, 0, 0,
764 PROOF_QUALITY
, FF_DONTCARE
,
769 if (DIALOG_GetCharSize(hFont
,&charSize
))
775 TRACE("units = %d,%d\n", xUnit
, yUnit
);
778 /* Create dialog main window */
780 rect
.left
= rect
.top
= 0;
781 rect
.right
= MulDiv(template.cx
, xUnit
, 4);
782 rect
.bottom
= MulDiv(template.cy
, yUnit
, 8);
783 if (template.style
& DS_MODALFRAME
)
784 template.exStyle
|= WS_EX_DLGMODALFRAME
;
785 AdjustWindowRectEx( &rect
, template.style
,
786 hMenu
? TRUE
: FALSE
, template.exStyle
);
787 rect
.right
-= rect
.left
;
788 rect
.bottom
-= rect
.top
;
790 if ((INT16
)template.x
== CW_USEDEFAULT16
)
792 rect
.left
= rect
.top
= win32Template
? CW_USEDEFAULT
: CW_USEDEFAULT16
;
796 if (template.style
& DS_CENTER
)
798 rect
.left
= (GetSystemMetrics(SM_CXSCREEN
) - rect
.right
) / 2;
799 rect
.top
= (GetSystemMetrics(SM_CYSCREEN
) - rect
.bottom
) / 2;
803 rect
.left
+= MulDiv(template.x
, xUnit
, 4);
804 rect
.top
+= MulDiv(template.y
, yUnit
, 8);
806 if ( !(template.style
& WS_CHILD
) )
810 if( !(template.style
& DS_ABSALIGN
) )
811 ClientToScreen( owner
, (POINT
*)&rect
);
813 /* try to fit it into the desktop */
815 if( (dX
= rect
.left
+ rect
.right
+ GetSystemMetrics(SM_CXDLGFRAME
)
816 - GetSystemMetrics(SM_CXSCREEN
)) > 0 ) rect
.left
-= dX
;
817 if( (dY
= rect
.top
+ rect
.bottom
+ GetSystemMetrics(SM_CYDLGFRAME
)
818 - GetSystemMetrics(SM_CYSCREEN
)) > 0 ) rect
.top
-= dY
;
819 if( rect
.left
< 0 ) rect
.left
= 0;
820 if( rect
.top
< 0 ) rect
.top
= 0;
825 ownerEnabled
= DIALOG_DisableOwner( owner
);
828 hwnd
= CreateWindowEx16(template.exStyle
, template.className
,
829 template.caption
, template.style
& ~WS_VISIBLE
,
830 rect
.left
, rect
.top
, rect
.right
, rect
.bottom
,
831 owner
, hMenu
, hInst
, NULL
);
833 hwnd
= CreateWindowExW(template.exStyle
, (LPCWSTR
)template.className
,
834 (LPCWSTR
)template.caption
,
835 template.style
& ~WS_VISIBLE
,
836 rect
.left
, rect
.top
, rect
.right
, rect
.bottom
,
837 owner
, hMenu
, hInst
, NULL
);
841 if (hFont
) DeleteObject( hFont
);
842 if (hMenu
) DestroyMenu( hMenu
);
843 if (modal
&& ownerEnabled
) DIALOG_EnableOwner(owner
);
846 wndPtr
= WIN_FindWndPtr( hwnd
);
847 wndPtr
->flags
|= WIN_ISDIALOG
;
848 wndPtr
->helpContext
= template.helpId
;
850 /* Initialise dialog extra data */
852 dlgInfo
= (DIALOGINFO
*)wndPtr
->wExtra
;
853 WINPROC_SetProc( &dlgInfo
->dlgProc
, (WNDPROC16
)dlgProc
, procType
, WIN_PROC_WINDOW
);
854 dlgInfo
->hUserFont
= hFont
;
855 dlgInfo
->hMenu
= hMenu
;
856 dlgInfo
->xBaseUnit
= xUnit
;
857 dlgInfo
->yBaseUnit
= yUnit
;
858 dlgInfo
->msgResult
= 0;
859 dlgInfo
->idResult
= 0;
860 dlgInfo
->flags
= ownerEnabled
? DF_OWNERENABLED
: 0;
861 dlgInfo
->hDialogHeap
= 0;
863 if (dlgInfo
->hUserFont
)
864 SendMessageA( hwnd
, WM_SETFONT
, (WPARAM
)dlgInfo
->hUserFont
, 0 );
866 /* Create controls */
868 if (DIALOG_CreateControls( wndPtr
, dlgTemplate
, &template,
869 hInst
, win32Template
))
871 HWND hwndPreInitFocus
;
873 /* Send initialisation messages and set focus */
875 dlgInfo
->hwndFocus
= GetNextDlgTabItem( hwnd
, 0, FALSE
);
877 hwndPreInitFocus
= GetFocus();
878 if (SendMessageA( hwnd
, WM_INITDIALOG
, (WPARAM
)dlgInfo
->hwndFocus
, param
))
880 /* check where the focus is again,
881 * some controls status might have changed in WM_INITDIALOG */
882 dlgInfo
->hwndFocus
= GetNextDlgTabItem( hwnd
, 0, FALSE
);
883 SetFocus( dlgInfo
->hwndFocus
);
887 /* If the dlgproc has returned FALSE (indicating handling of keyboard focus)
888 but the focus has not changed, set the focus where we expect it. */
889 if ( (wndPtr
->dwStyle
& WS_VISIBLE
) && ( GetFocus() == hwndPreInitFocus
) )
891 dlgInfo
->hwndFocus
= GetNextDlgTabItem( hwnd
, 0, FALSE
);
892 SetFocus( dlgInfo
->hwndFocus
);
896 if (template.style
& WS_VISIBLE
&& !(wndPtr
->dwStyle
& WS_VISIBLE
))
898 ShowWindow( hwnd
, SW_SHOWNORMAL
); /* SW_SHOW doesn't always work */
900 WIN_ReleaseWndPtr(wndPtr
);
903 WIN_ReleaseWndPtr(wndPtr
);
904 if( IsWindow(hwnd
) ) DestroyWindow( hwnd
);
905 if (modal
&& ownerEnabled
) DIALOG_EnableOwner(owner
);
910 /***********************************************************************
911 * CreateDialog (USER.89)
913 HWND16 WINAPI
CreateDialog16( HINSTANCE16 hInst
, LPCSTR dlgTemplate
,
914 HWND16 owner
, DLGPROC16 dlgProc
)
916 return CreateDialogParam16( hInst
, dlgTemplate
, owner
, dlgProc
, 0 );
920 /***********************************************************************
921 * CreateDialogParam (USER.241)
923 HWND16 WINAPI
CreateDialogParam16( HINSTANCE16 hInst
, LPCSTR dlgTemplate
,
924 HWND16 owner
, DLGPROC16 dlgProc
,
932 TRACE("%04x,%s,%04x,%08lx,%ld\n",
933 hInst
, debugres_a(dlgTemplate
), owner
, (DWORD
)dlgProc
, param
);
935 if (!(hRsrc
= FindResource16( hInst
, dlgTemplate
, RT_DIALOGA
))) return 0;
936 if (!(hmem
= LoadResource16( hInst
, hRsrc
))) return 0;
937 if (!(data
= LockResource16( hmem
))) hwnd
= 0;
938 else hwnd
= CreateDialogIndirectParam16( hInst
, data
, owner
,
940 FreeResource16( hmem
);
944 /***********************************************************************
945 * CreateDialogParamA (USER32.@)
947 HWND WINAPI
CreateDialogParamA( HINSTANCE hInst
, LPCSTR name
,
948 HWND owner
, DLGPROC dlgProc
,
951 HANDLE hrsrc
= FindResourceA( hInst
, name
, RT_DIALOGA
);
952 if (!hrsrc
) return 0;
953 return CreateDialogIndirectParamA( hInst
,
954 (LPVOID
)LoadResource(hInst
, hrsrc
),
955 owner
, dlgProc
, param
);
959 /***********************************************************************
960 * CreateDialogParamW (USER32.@)
962 HWND WINAPI
CreateDialogParamW( HINSTANCE hInst
, LPCWSTR name
,
963 HWND owner
, DLGPROC dlgProc
,
966 HANDLE hrsrc
= FindResourceW( hInst
, name
, RT_DIALOGW
);
967 if (!hrsrc
) return 0;
968 return CreateDialogIndirectParamW( hInst
,
969 (LPVOID
)LoadResource(hInst
, hrsrc
),
970 owner
, dlgProc
, param
);
974 /***********************************************************************
975 * CreateDialogIndirect (USER.219)
977 HWND16 WINAPI
CreateDialogIndirect16( HINSTANCE16 hInst
, LPCVOID dlgTemplate
,
978 HWND16 owner
, DLGPROC16 dlgProc
)
980 return CreateDialogIndirectParam16( hInst
, dlgTemplate
, owner
, dlgProc
, 0);
984 /***********************************************************************
985 * CreateDialogIndirectParam (USER.242)
986 * CreateDialogIndirectParam16 (USER32.@)
988 HWND16 WINAPI
CreateDialogIndirectParam16( HINSTANCE16 hInst
,
990 HWND16 owner
, DLGPROC16 dlgProc
,
993 return DIALOG_CreateIndirect( hInst
, dlgTemplate
, FALSE
, owner
,
994 dlgProc
, param
, WIN_PROC_16
, FALSE
);
998 /***********************************************************************
999 * CreateDialogIndirectParamA (USER32.@)
1001 HWND WINAPI
CreateDialogIndirectParamA( HINSTANCE hInst
,
1002 LPCVOID dlgTemplate
,
1003 HWND owner
, DLGPROC dlgProc
,
1006 return DIALOG_CreateIndirect( hInst
, dlgTemplate
, TRUE
, owner
,
1007 (DLGPROC16
)dlgProc
, param
, WIN_PROC_32A
, FALSE
);
1010 /***********************************************************************
1011 * CreateDialogIndirectParamAorW (USER32.@)
1013 HWND WINAPI
CreateDialogIndirectParamAorW( HINSTANCE hInst
,
1014 LPCVOID dlgTemplate
,
1015 HWND owner
, DLGPROC dlgProc
,
1017 { FIXME("assume WIN_PROC_32W\n");
1018 return DIALOG_CreateIndirect( hInst
, dlgTemplate
, TRUE
, owner
,
1019 (DLGPROC16
)dlgProc
, param
, WIN_PROC_32W
, FALSE
);
1022 /***********************************************************************
1023 * CreateDialogIndirectParamW (USER32.@)
1025 HWND WINAPI
CreateDialogIndirectParamW( HINSTANCE hInst
,
1026 LPCVOID dlgTemplate
,
1027 HWND owner
, DLGPROC dlgProc
,
1030 return DIALOG_CreateIndirect( hInst
, dlgTemplate
, TRUE
, owner
,
1031 (DLGPROC16
)dlgProc
, param
, WIN_PROC_32W
, FALSE
);
1035 /***********************************************************************
1036 * DIALOG_DoDialogBox
1038 static INT
DIALOG_DoDialogBox( HWND hwnd
, HWND owner
)
1041 DIALOGINFO
* dlgInfo
;
1044 HWND ownerMsg
= GetAncestor( owner
, GA_ROOT
);
1046 if (!(wndPtr
= WIN_FindWndPtr( hwnd
))) return -1;
1047 dlgInfo
= (DIALOGINFO
*)wndPtr
->wExtra
;
1049 if (!(dlgInfo
->flags
& DF_END
)) /* was EndDialog called in WM_INITDIALOG ? */
1051 ShowWindow( hwnd
, SW_SHOW
);
1054 if (!(wndPtr
->dwStyle
& DS_NOIDLEMSG
))
1056 if (!PeekMessageW( &msg
, 0, 0, 0, PM_REMOVE
))
1058 /* No message present -> send ENTERIDLE and wait */
1059 SendMessageW( ownerMsg
, WM_ENTERIDLE
, MSGF_DIALOGBOX
, (LPARAM
)hwnd
);
1060 if (!GetMessageW( &msg
, 0, 0, 0 )) break;
1063 else if (!GetMessageW( &msg
, 0, 0, 0 )) break;
1065 if (CallMsgFilterW( &msg
, MSGF_DIALOGBOX
)) continue;
1067 if (!(dlgInfo
->flags
& DF_END
) && !IsDialogMessageW( hwnd
, &msg
))
1069 TranslateMessage( &msg
);
1070 DispatchMessageW( &msg
);
1072 if (dlgInfo
->flags
& DF_END
) break;
1075 if (dlgInfo
->flags
& DF_OWNERENABLED
) DIALOG_EnableOwner( owner
);
1076 retval
= dlgInfo
->idResult
;
1077 WIN_ReleaseWndPtr(wndPtr
);
1078 DestroyWindow( hwnd
);
1083 /***********************************************************************
1084 * DialogBox (USER.87)
1086 INT16 WINAPI
DialogBox16( HINSTANCE16 hInst
, LPCSTR dlgTemplate
,
1087 HWND16 owner
, DLGPROC16 dlgProc
)
1089 return DialogBoxParam16( hInst
, dlgTemplate
, owner
, dlgProc
, 0 );
1093 /***********************************************************************
1094 * DialogBoxParam (USER.239)
1096 INT16 WINAPI
DialogBoxParam16( HINSTANCE16 hInst
, LPCSTR
template,
1097 HWND16 owner
, DLGPROC16 dlgProc
, LPARAM param
)
1105 if (!(hRsrc
= FindResource16( hInst
, template, RT_DIALOGA
))) return 0;
1106 if (!(hmem
= LoadResource16( hInst
, hRsrc
))) return 0;
1107 if (!(data
= LockResource16( hmem
))) hwnd
= 0;
1108 else hwnd
= DIALOG_CreateIndirect( hInst
, data
, FALSE
, owner
,
1109 dlgProc
, param
, WIN_PROC_16
, TRUE
);
1111 ret
=(INT16
)DIALOG_DoDialogBox( hwnd
, owner
);
1112 if (data
) GlobalUnlock16( hmem
);
1113 FreeResource16( hmem
);
1118 /***********************************************************************
1119 * DialogBoxParamA (USER32.@)
1121 INT WINAPI
DialogBoxParamA( HINSTANCE hInst
, LPCSTR name
,
1122 HWND owner
, DLGPROC dlgProc
, LPARAM param
)
1125 HANDLE hrsrc
= FindResourceA( hInst
, name
, RT_DIALOGA
);
1126 if (!hrsrc
) return 0;
1127 hwnd
= DIALOG_CreateIndirect( hInst
, (LPVOID
)LoadResource(hInst
, hrsrc
),
1129 (DLGPROC16
) dlgProc
, param
, WIN_PROC_32A
, TRUE
);
1130 if (hwnd
) return DIALOG_DoDialogBox( hwnd
, owner
);
1135 /***********************************************************************
1136 * DialogBoxParamW (USER32.@)
1138 INT WINAPI
DialogBoxParamW( HINSTANCE hInst
, LPCWSTR name
,
1139 HWND owner
, DLGPROC dlgProc
, LPARAM param
)
1142 HANDLE hrsrc
= FindResourceW( hInst
, name
, RT_DIALOGW
);
1143 if (!hrsrc
) return 0;
1144 hwnd
= DIALOG_CreateIndirect( hInst
, (LPVOID
)LoadResource(hInst
, hrsrc
),
1146 (DLGPROC16
)dlgProc
, param
, WIN_PROC_32W
, TRUE
);
1147 if (hwnd
) return DIALOG_DoDialogBox( hwnd
, owner
);
1152 /***********************************************************************
1153 * DialogBoxIndirect (USER.218)
1155 INT16 WINAPI
DialogBoxIndirect16( HINSTANCE16 hInst
, HANDLE16 dlgTemplate
,
1156 HWND16 owner
, DLGPROC16 dlgProc
)
1158 return DialogBoxIndirectParam16( hInst
, dlgTemplate
, owner
, dlgProc
, 0 );
1162 /***********************************************************************
1163 * DialogBoxIndirectParam (USER.240)
1164 * DialogBoxIndirectParam16 (USER32.@)
1166 INT16 WINAPI
DialogBoxIndirectParam16( HINSTANCE16 hInst
, HANDLE16 dlgTemplate
,
1167 HWND16 owner
, DLGPROC16 dlgProc
,
1173 if (!(ptr
= GlobalLock16( dlgTemplate
))) return -1;
1174 hwnd
= DIALOG_CreateIndirect( hInst
, ptr
, FALSE
, owner
,
1175 dlgProc
, param
, WIN_PROC_16
, TRUE
);
1176 GlobalUnlock16( dlgTemplate
);
1177 if (hwnd
) return DIALOG_DoDialogBox( hwnd
, owner
);
1182 /***********************************************************************
1183 * DialogBoxIndirectParamA (USER32.@)
1185 INT WINAPI
DialogBoxIndirectParamA(HINSTANCE hInstance
, LPCVOID
template,
1186 HWND owner
, DLGPROC dlgProc
,
1189 HWND hwnd
= DIALOG_CreateIndirect( hInstance
, template, TRUE
, owner
,
1190 (DLGPROC16
) dlgProc
, param
, WIN_PROC_32A
, TRUE
);
1191 if (hwnd
) return DIALOG_DoDialogBox( hwnd
, owner
);
1196 /***********************************************************************
1197 * DialogBoxIndirectParamW (USER32.@)
1199 INT WINAPI
DialogBoxIndirectParamW(HINSTANCE hInstance
, LPCVOID
template,
1200 HWND owner
, DLGPROC dlgProc
,
1203 HWND hwnd
= DIALOG_CreateIndirect( hInstance
, template, TRUE
, owner
,
1204 (DLGPROC16
)dlgProc
, param
, WIN_PROC_32W
, TRUE
);
1205 if (hwnd
) return DIALOG_DoDialogBox( hwnd
, owner
);
1209 /***********************************************************************
1210 * DialogBoxIndirectParamAorW (USER32.@)
1212 INT WINAPI
DialogBoxIndirectParamAorW(HINSTANCE hInstance
, LPCVOID
template,
1213 HWND owner
, DLGPROC dlgProc
,
1214 LPARAM param
, DWORD x
)
1217 FIXME("0x%08x %p 0x%08x %p 0x%08lx 0x%08lx\n",
1218 hInstance
, template, owner
, dlgProc
, param
, x
);
1219 hwnd
= DIALOG_CreateIndirect( hInstance
, template, TRUE
, owner
,
1220 (DLGPROC16
)dlgProc
, param
, WIN_PROC_32W
, TRUE
);
1221 if (hwnd
) return DIALOG_DoDialogBox( hwnd
, owner
);
1225 /***********************************************************************
1226 * EndDialog (USER.88)
1228 BOOL16 WINAPI
EndDialog16( HWND16 hwnd
, INT16 retval
)
1230 return EndDialog( hwnd
, retval
);
1234 /***********************************************************************
1235 * EndDialog (USER32.@)
1237 BOOL WINAPI
EndDialog( HWND hwnd
, INT retval
)
1239 WND
* wndPtr
= WIN_FindWndPtr( hwnd
);
1240 BOOL wasEnabled
= TRUE
;
1241 DIALOGINFO
* dlgInfo
;
1244 TRACE("%04x %d\n", hwnd
, retval
);
1248 ERR("got invalid window handle (%04x); buggy app !?\n", hwnd
);
1252 if ((dlgInfo
= (DIALOGINFO
*)wndPtr
->wExtra
))
1254 dlgInfo
->idResult
= retval
;
1255 dlgInfo
->flags
|= DF_END
;
1256 wasEnabled
= (dlgInfo
->flags
& DF_OWNERENABLED
);
1258 WIN_ReleaseWndPtr(wndPtr
);
1260 if (wasEnabled
&& (owner
= GetWindow( hwnd
, GW_OWNER
)))
1261 DIALOG_EnableOwner( owner
);
1263 /* Windows sets the focus to the dialog itself in EndDialog */
1265 if (IsChild(hwnd
, GetFocus()))
1268 /* Don't have to send a ShowWindow(SW_HIDE), just do
1269 SetWindowPos with SWP_HIDEWINDOW as done in Windows */
1271 SetWindowPos(hwnd
, (HWND
)0, 0, 0, 0, 0, SWP_NOMOVE
| SWP_NOSIZE
1272 | SWP_NOZORDER
| SWP_NOACTIVATE
| SWP_HIDEWINDOW
);
1274 /* unblock dialog loop */
1275 PostMessageA(hwnd
, WM_NULL
, 0, 0);
1280 /***********************************************************************
1281 * DIALOG_IsAccelerator
1283 static BOOL
DIALOG_IsAccelerator( HWND hwnd
, HWND hwndDlg
, WPARAM vKey
)
1285 HWND hwndControl
= hwnd
;
1292 DWORD style
= GetWindowLongW( hwndControl
, GWL_STYLE
);
1293 if ((style
& (WS_VISIBLE
| WS_DISABLED
)) == WS_VISIBLE
)
1295 dlgCode
= SendMessageA( hwndControl
, WM_GETDLGCODE
, 0, 0 );
1296 if ( (dlgCode
& (DLGC_BUTTON
| DLGC_STATIC
)) &&
1297 GetWindowTextW( hwndControl
, buffer
, sizeof(buffer
)/sizeof(WCHAR
) ))
1299 /* find the accelerator key */
1300 LPWSTR p
= buffer
- 2;
1306 p
= strchrW( p
+ 2, '&' );
1308 while (p
!= NULL
&& p
[1] == '&');
1310 /* and check if it's the one we're looking for */
1311 MultiByteToWideChar(CP_ACP
, 0, &a_char
, 1, &w_char
, 1);
1312 if (p
!= NULL
&& toupperW( p
[1] ) == toupperW( w_char
) )
1314 if ((dlgCode
& DLGC_STATIC
) || (style
& 0x0f) == BS_GROUPBOX
)
1316 /* set focus to the control */
1317 SendMessageA( hwndDlg
, WM_NEXTDLGCTL
, hwndControl
, 1);
1318 /* and bump it on to next */
1319 SendMessageA( hwndDlg
, WM_NEXTDLGCTL
, 0, 0);
1321 else if (dlgCode
& DLGC_BUTTON
)
1323 /* send BM_CLICK message to the control */
1324 SendMessageA( hwndControl
, BM_CLICK
, 0, 0 );
1329 hwndNext
= GetWindow( hwndControl
, GW_CHILD
);
1333 if (!hwndNext
) hwndNext
= GetWindow( hwndControl
, GW_HWNDNEXT
);
1335 while (!hwndNext
&& hwndControl
)
1337 hwndControl
= GetParent( hwndControl
);
1338 if (hwndControl
== hwndDlg
)
1340 if(hwnd
==hwndDlg
) /* prevent endless loop */
1345 hwndNext
= GetWindow( hwndDlg
, GW_CHILD
);
1348 hwndNext
= GetWindow( hwndControl
, GW_HWNDNEXT
);
1350 hwndControl
= hwndNext
;
1352 while (hwndControl
&& (hwndControl
!= hwnd
));
1357 /***********************************************************************
1358 * DIALOG_FindMsgDestination
1360 * The messages that IsDialogMessage sends may not go to the dialog
1361 * calling IsDialogMessage if that dialog is a child, and it has the
1362 * DS_CONTROL style set.
1363 * We propagate up until we hit one that does not have DS_CONTROL, or
1364 * whose parent is not a dialog.
1366 * This is undocumented behaviour.
1368 static HWND
DIALOG_FindMsgDestination( HWND hwndDlg
)
1370 while (GetWindowLongA(hwndDlg
, GWL_STYLE
) & DS_CONTROL
)
1373 HWND hParent
= GetParent(hwndDlg
);
1374 if (!hParent
) break;
1376 pParent
= WIN_FindWndPtr(hParent
);
1377 if (!pParent
) break;
1379 if (!(pParent
->flags
& WIN_ISDIALOG
))
1381 WIN_ReleaseWndPtr(pParent
);
1384 WIN_ReleaseWndPtr(pParent
);
1392 /***********************************************************************
1393 * DIALOG_IsDialogMessage
1395 static BOOL
DIALOG_IsDialogMessage( HWND hwnd
, HWND hwndDlg
,
1396 UINT message
, WPARAM wParam
,
1397 LPARAM lParam
, BOOL
*translate
,
1398 BOOL
*dispatch
, INT dlgCode
)
1400 *translate
= *dispatch
= FALSE
;
1402 if (message
== WM_PAINT
)
1404 /* Apparently, we have to handle this one as well */
1409 /* Only the key messages get special processing */
1410 if ((message
!= WM_KEYDOWN
) &&
1411 (message
!= WM_SYSKEYDOWN
) &&
1412 (message
!= WM_SYSCHAR
) &&
1413 (message
!= WM_CHAR
))
1416 if (dlgCode
& DLGC_WANTMESSAGE
)
1418 *translate
= *dispatch
= TRUE
;
1422 hwndDlg
= DIALOG_FindMsgDestination(hwndDlg
);
1430 if (!(dlgCode
& DLGC_WANTTAB
))
1432 SendMessageA( hwndDlg
, WM_NEXTDLGCTL
,
1433 (GetKeyState(VK_SHIFT
) & 0x8000), 0 );
1442 if (!(dlgCode
& DLGC_WANTARROWS
))
1444 BOOL fPrevious
= (wParam
== VK_LEFT
|| wParam
== VK_UP
);
1446 GetNextDlgGroupItem (hwndDlg
, GetFocus(), fPrevious
);
1447 SendMessageA( hwndDlg
, WM_NEXTDLGCTL
, hwndNext
, 1 );
1453 SendMessageA( hwndDlg
, WM_COMMAND
, IDCANCEL
,
1454 (LPARAM
)GetDlgItem( hwndDlg
, IDCANCEL
) );
1459 DWORD dw
= SendMessageW( hwndDlg
, DM_GETDEFID
, 0, 0 );
1460 if (HIWORD(dw
) == DC_HASDEFID
)
1462 SendMessageA( hwndDlg
, WM_COMMAND
,
1463 MAKEWPARAM( LOWORD(dw
), BN_CLICKED
),
1464 (LPARAM
)GetDlgItem(hwndDlg
, LOWORD(dw
)));
1468 SendMessageA( hwndDlg
, WM_COMMAND
, IDOK
,
1469 (LPARAM
)GetDlgItem( hwndDlg
, IDOK
) );
1476 break; /* case WM_KEYDOWN */
1479 if (dlgCode
& DLGC_WANTCHARS
) break;
1483 if (DIALOG_IsAccelerator( hwnd
, hwndDlg
, wParam
))
1485 /* don't translate or dispatch */
1495 /* If we get here, the message has not been treated specially */
1496 /* and can be sent to its destination window. */
1502 /***********************************************************************
1503 * IsDialogMessage (USER.90)
1505 BOOL16 WINAPI
IsDialogMessage16( HWND16 hwndDlg
, SEGPTR msg16
)
1507 LPMSG16 msg
= MapSL(msg16
);
1508 BOOL ret
, translate
, dispatch
;
1511 if ((hwndDlg
!= msg
->hwnd
) && !IsChild16( hwndDlg
, msg
->hwnd
))
1514 if ((msg
->message
== WM_KEYDOWN
) ||
1515 (msg
->message
== WM_CHAR
))
1517 dlgCode
= SendMessage16( msg
->hwnd
, WM_GETDLGCODE
, 0, (LPARAM
)msg16
);
1519 ret
= DIALOG_IsDialogMessage( msg
->hwnd
, hwndDlg
, msg
->message
,
1520 msg
->wParam
, msg
->lParam
,
1521 &translate
, &dispatch
, dlgCode
);
1522 if (translate
) TranslateMessage16( msg
);
1523 if (dispatch
) DispatchMessage16( msg
);
1528 /***********************************************************************
1529 * IsDialogMessage (USER32.@)
1530 * IsDialogMessageA (USER32.@)
1532 BOOL WINAPI
IsDialogMessageA( HWND hwndDlg
, LPMSG msg
)
1534 BOOL ret
, translate
, dispatch
;
1537 if ((hwndDlg
!= msg
->hwnd
) && !IsChild( hwndDlg
, msg
->hwnd
))
1540 if ((msg
->message
== WM_KEYDOWN
) ||
1541 (msg
->message
== WM_CHAR
))
1543 dlgCode
= SendMessageA( msg
->hwnd
, WM_GETDLGCODE
, 0, (LPARAM
)msg
);
1545 ret
= DIALOG_IsDialogMessage( msg
->hwnd
, hwndDlg
, msg
->message
,
1546 msg
->wParam
, msg
->lParam
,
1547 &translate
, &dispatch
, dlgCode
);
1548 if (translate
) TranslateMessage( msg
);
1549 if (dispatch
) DispatchMessageA( msg
);
1554 /***********************************************************************
1555 * IsDialogMessageW (USER32.@)
1557 BOOL WINAPI
IsDialogMessageW( HWND hwndDlg
, LPMSG msg
)
1559 BOOL ret
, translate
, dispatch
;
1562 if ((hwndDlg
!= msg
->hwnd
) && !IsChild( hwndDlg
, msg
->hwnd
))
1565 if ((msg
->message
== WM_KEYDOWN
) ||
1566 (msg
->message
== WM_CHAR
))
1568 dlgCode
= SendMessageW( msg
->hwnd
, WM_GETDLGCODE
, 0, (LPARAM
)msg
);
1570 ret
= DIALOG_IsDialogMessage( msg
->hwnd
, hwndDlg
, msg
->message
,
1571 msg
->wParam
, msg
->lParam
,
1572 &translate
, &dispatch
, dlgCode
);
1573 if (translate
) TranslateMessage( msg
);
1574 if (dispatch
) DispatchMessageW( msg
);
1579 /***********************************************************************
1580 * GetDlgCtrlID (USER.277)
1582 INT16 WINAPI
GetDlgCtrlID16( HWND16 hwnd
)
1584 return GetDlgCtrlID( hwnd
);
1588 /***********************************************************************
1589 * GetDlgCtrlID (USER32.@)
1591 INT WINAPI
GetDlgCtrlID( HWND hwnd
)
1593 return GetWindowLongW( hwnd
, GWL_ID
);
1597 /***********************************************************************
1598 * GetDlgItem (USER.91)
1600 HWND16 WINAPI
GetDlgItem16( HWND16 hwndDlg
, INT16 id
)
1602 return GetDlgItem( hwndDlg
, id
);
1606 /***********************************************************************
1607 * GetDlgItem (USER32.@)
1609 HWND WINAPI
GetDlgItem( HWND hwndDlg
, INT id
)
1612 HWND
*list
= WIN_ListChildren( hwndDlg
);
1615 if (!list
) return 0;
1617 for (i
= 0; list
[i
]; i
++) if (GetWindowLongW( list
[i
], GWL_ID
) == id
) break;
1619 HeapFree( GetProcessHeap(), 0, list
);
1624 /*******************************************************************
1625 * SendDlgItemMessage (USER.101)
1627 LRESULT WINAPI
SendDlgItemMessage16( HWND16 hwnd
, INT16 id
, UINT16 msg
,
1628 WPARAM16 wParam
, LPARAM lParam
)
1630 HWND16 hwndCtrl
= GetDlgItem16( hwnd
, id
);
1631 if (hwndCtrl
) return SendMessage16( hwndCtrl
, msg
, wParam
, lParam
);
1636 /*******************************************************************
1637 * SendDlgItemMessageA (USER32.@)
1639 LRESULT WINAPI
SendDlgItemMessageA( HWND hwnd
, INT id
, UINT msg
,
1640 WPARAM wParam
, LPARAM lParam
)
1642 HWND hwndCtrl
= GetDlgItem( hwnd
, id
);
1643 if (hwndCtrl
) return SendMessageA( hwndCtrl
, msg
, wParam
, lParam
);
1648 /*******************************************************************
1649 * SendDlgItemMessageW (USER32.@)
1651 LRESULT WINAPI
SendDlgItemMessageW( HWND hwnd
, INT id
, UINT msg
,
1652 WPARAM wParam
, LPARAM lParam
)
1654 HWND hwndCtrl
= GetDlgItem( hwnd
, id
);
1655 if (hwndCtrl
) return SendMessageW( hwndCtrl
, msg
, wParam
, lParam
);
1660 /*******************************************************************
1661 * SetDlgItemText (USER.92)
1663 void WINAPI
SetDlgItemText16( HWND16 hwnd
, INT16 id
, SEGPTR lpString
)
1665 SendDlgItemMessage16( hwnd
, id
, WM_SETTEXT
, 0, (LPARAM
)lpString
);
1669 /*******************************************************************
1670 * SetDlgItemTextA (USER32.@)
1672 BOOL WINAPI
SetDlgItemTextA( HWND hwnd
, INT id
, LPCSTR lpString
)
1674 return SendDlgItemMessageA( hwnd
, id
, WM_SETTEXT
, 0, (LPARAM
)lpString
);
1678 /*******************************************************************
1679 * SetDlgItemTextW (USER32.@)
1681 BOOL WINAPI
SetDlgItemTextW( HWND hwnd
, INT id
, LPCWSTR lpString
)
1683 return SendDlgItemMessageW( hwnd
, id
, WM_SETTEXT
, 0, (LPARAM
)lpString
);
1687 /***********************************************************************
1688 * GetDlgItemText (USER.93)
1690 INT16 WINAPI
GetDlgItemText16( HWND16 hwnd
, INT16 id
, SEGPTR str
, UINT16 len
)
1692 return (INT16
)SendDlgItemMessage16( hwnd
, id
, WM_GETTEXT
,
1697 /***********************************************************************
1698 * GetDlgItemTextA (USER32.@)
1700 INT WINAPI
GetDlgItemTextA( HWND hwnd
, INT id
, LPSTR str
, UINT len
)
1702 return (INT
)SendDlgItemMessageA( hwnd
, id
, WM_GETTEXT
,
1707 /***********************************************************************
1708 * GetDlgItemTextW (USER32.@)
1710 INT WINAPI
GetDlgItemTextW( HWND hwnd
, INT id
, LPWSTR str
, UINT len
)
1712 return (INT
)SendDlgItemMessageW( hwnd
, id
, WM_GETTEXT
,
1717 /*******************************************************************
1718 * SetDlgItemInt (USER.94)
1720 void WINAPI
SetDlgItemInt16( HWND16 hwnd
, INT16 id
, UINT16 value
, BOOL16 fSigned
)
1722 SetDlgItemInt( hwnd
, (UINT
)(UINT16
)id
, value
, fSigned
);
1726 /*******************************************************************
1727 * SetDlgItemInt (USER32.@)
1729 BOOL WINAPI
SetDlgItemInt( HWND hwnd
, INT id
, UINT value
,
1734 if (fSigned
) sprintf( str
, "%d", (INT
)value
);
1735 else sprintf( str
, "%u", value
);
1736 SendDlgItemMessageA( hwnd
, id
, WM_SETTEXT
, 0, (LPARAM
)str
);
1741 /***********************************************************************
1742 * GetDlgItemInt (USER.95)
1744 UINT16 WINAPI
GetDlgItemInt16( HWND16 hwnd
, INT16 id
, BOOL16
*translated
,
1750 if (translated
) *translated
= FALSE
;
1751 result
= GetDlgItemInt( hwnd
, (UINT
)(UINT16
)id
, &ok
, fSigned
);
1755 if (((INT
)result
< -32767) || ((INT
)result
> 32767)) return 0;
1759 if (result
> 65535) return 0;
1761 if (translated
) *translated
= TRUE
;
1762 return (UINT16
)result
;
1766 /***********************************************************************
1767 * GetDlgItemInt (USER32.@)
1769 UINT WINAPI
GetDlgItemInt( HWND hwnd
, INT id
, BOOL
*translated
,
1776 if (translated
) *translated
= FALSE
;
1777 if (!SendDlgItemMessageA(hwnd
, id
, WM_GETTEXT
, sizeof(str
), (LPARAM
)str
))
1781 result
= strtol( str
, &endptr
, 10 );
1782 if (!endptr
|| (endptr
== str
)) /* Conversion was unsuccessful */
1784 if (((result
== LONG_MIN
) || (result
== LONG_MAX
)) && (errno
==ERANGE
))
1789 result
= strtoul( str
, &endptr
, 10 );
1790 if (!endptr
|| (endptr
== str
)) /* Conversion was unsuccessful */
1792 if ((result
== ULONG_MAX
) && (errno
== ERANGE
)) return 0;
1794 if (translated
) *translated
= TRUE
;
1795 return (UINT
)result
;
1799 /***********************************************************************
1800 * CheckDlgButton (USER.97)
1802 BOOL16 WINAPI
CheckDlgButton16( HWND16 hwnd
, INT16 id
, UINT16 check
)
1804 SendDlgItemMessageA( hwnd
, id
, BM_SETCHECK
, check
, 0 );
1809 /***********************************************************************
1810 * CheckDlgButton (USER32.@)
1812 BOOL WINAPI
CheckDlgButton( HWND hwnd
, INT id
, UINT check
)
1814 SendDlgItemMessageA( hwnd
, id
, BM_SETCHECK
, check
, 0 );
1819 /***********************************************************************
1820 * IsDlgButtonChecked (USER.98)
1822 UINT16 WINAPI
IsDlgButtonChecked16( HWND16 hwnd
, UINT16 id
)
1824 return (UINT16
)SendDlgItemMessageA( hwnd
, id
, BM_GETCHECK
, 0, 0 );
1828 /***********************************************************************
1829 * IsDlgButtonChecked (USER32.@)
1831 UINT WINAPI
IsDlgButtonChecked( HWND hwnd
, UINT id
)
1833 return (UINT
)SendDlgItemMessageA( hwnd
, id
, BM_GETCHECK
, 0, 0 );
1837 /***********************************************************************
1838 * CheckRadioButton (USER.96)
1840 BOOL16 WINAPI
CheckRadioButton16( HWND16 hwndDlg
, UINT16 firstID
,
1841 UINT16 lastID
, UINT16 checkID
)
1843 return CheckRadioButton( hwndDlg
, firstID
, lastID
, checkID
);
1847 /***********************************************************************
1850 * Callback function used to check/uncheck radio buttons that fall
1851 * within a specific range of IDs.
1853 static BOOL CALLBACK
CheckRB(HWND hwndChild
, LPARAM lParam
)
1855 LONG lChildID
= GetWindowLongA(hwndChild
, GWL_ID
);
1856 RADIOGROUP
*lpRadioGroup
= (RADIOGROUP
*) lParam
;
1858 if ((lChildID
>= lpRadioGroup
->firstID
) &&
1859 (lChildID
<= lpRadioGroup
->lastID
))
1861 if (lChildID
== lpRadioGroup
->checkID
)
1863 SendMessageA(hwndChild
, BM_SETCHECK
, BST_CHECKED
, 0);
1867 SendMessageA(hwndChild
, BM_SETCHECK
, BST_UNCHECKED
, 0);
1875 /***********************************************************************
1876 * CheckRadioButton (USER32.@)
1878 BOOL WINAPI
CheckRadioButton( HWND hwndDlg
, UINT firstID
,
1879 UINT lastID
, UINT checkID
)
1881 RADIOGROUP radioGroup
;
1883 /* perform bounds checking for a radio button group */
1884 radioGroup
.firstID
= min(min(firstID
, lastID
), checkID
);
1885 radioGroup
.lastID
= max(max(firstID
, lastID
), checkID
);
1886 radioGroup
.checkID
= checkID
;
1888 return EnumChildWindows(hwndDlg
, (WNDENUMPROC
)CheckRB
,
1889 (LPARAM
)&radioGroup
);
1893 /***********************************************************************
1894 * GetDialogBaseUnits (USER.243)
1895 * GetDialogBaseUnits (USER32.@)
1897 DWORD WINAPI
GetDialogBaseUnits(void)
1899 return MAKELONG( xBaseUnit
, yBaseUnit
);
1903 /***********************************************************************
1904 * MapDialogRect (USER.103)
1906 void WINAPI
MapDialogRect16( HWND16 hwnd
, LPRECT16 rect
)
1908 DIALOGINFO
* dlgInfo
;
1909 WND
* wndPtr
= WIN_FindWndPtr( hwnd
);
1910 if (!wndPtr
) return;
1911 dlgInfo
= (DIALOGINFO
*)wndPtr
->wExtra
;
1912 rect
->left
= MulDiv(rect
->left
, dlgInfo
->xBaseUnit
, 4);
1913 rect
->right
= MulDiv(rect
->right
, dlgInfo
->xBaseUnit
, 4);
1914 rect
->top
= MulDiv(rect
->top
, dlgInfo
->yBaseUnit
, 8);
1915 rect
->bottom
= MulDiv(rect
->bottom
, dlgInfo
->yBaseUnit
, 8);
1916 WIN_ReleaseWndPtr(wndPtr
);
1920 /***********************************************************************
1921 * MapDialogRect (USER32.@)
1923 BOOL WINAPI
MapDialogRect( HWND hwnd
, LPRECT rect
)
1925 DIALOGINFO
* dlgInfo
;
1926 WND
* wndPtr
= WIN_FindWndPtr( hwnd
);
1927 if (!wndPtr
) return FALSE
;
1928 dlgInfo
= (DIALOGINFO
*)wndPtr
->wExtra
;
1929 rect
->left
= MulDiv(rect
->left
, dlgInfo
->xBaseUnit
, 4);
1930 rect
->right
= MulDiv(rect
->right
, dlgInfo
->xBaseUnit
, 4);
1931 rect
->top
= MulDiv(rect
->top
, dlgInfo
->yBaseUnit
, 8);
1932 rect
->bottom
= MulDiv(rect
->bottom
, dlgInfo
->yBaseUnit
, 8);
1933 WIN_ReleaseWndPtr(wndPtr
);
1938 /***********************************************************************
1939 * GetNextDlgGroupItem (USER.227)
1941 HWND16 WINAPI
GetNextDlgGroupItem16( HWND16 hwndDlg
, HWND16 hwndCtrl
,
1944 return (HWND16
)GetNextDlgGroupItem( hwndDlg
, hwndCtrl
, fPrevious
);
1948 /***********************************************************************
1949 * GetNextDlgGroupItem (USER32.@)
1951 HWND WINAPI
GetNextDlgGroupItem( HWND hwndDlg
, HWND hwndCtrl
,
1954 HWND hwnd
, retvalue
;
1958 /* if the hwndCtrl is the child of the control in the hwndDlg,
1959 * then the hwndDlg has to be the parent of the hwndCtrl */
1960 if(GetParent(hwndCtrl
) != hwndDlg
&& GetParent(GetParent(hwndCtrl
)) == hwndDlg
)
1961 hwndDlg
= GetParent(hwndCtrl
);
1966 /* Make sure hwndCtrl is a top-level child */
1967 HWND parent
= GetParent( hwndCtrl
);
1968 while (parent
&& parent
!= hwndDlg
) parent
= GetParent(parent
);
1969 if (parent
!= hwndDlg
) return 0;
1973 /* No ctrl specified -> start from the beginning */
1974 if (!(hwndCtrl
= GetWindow( hwndDlg
, GW_CHILD
))) return 0;
1975 if (fPrevious
) hwndCtrl
= GetWindow( hwndCtrl
, GW_HWNDLAST
);
1978 retvalue
= hwndCtrl
;
1979 hwnd
= GetWindow( hwndCtrl
, GW_HWNDNEXT
);
1982 if (!hwnd
|| (GetWindowLongW( hwnd
, GWL_STYLE
) & WS_GROUP
))
1984 /* Wrap-around to the beginning of the group */
1987 hwnd
= GetWindow( hwndDlg
, GW_CHILD
);
1988 for (tmp
= hwnd
; tmp
; tmp
= GetWindow( tmp
, GW_HWNDNEXT
) )
1990 if (GetWindowLongW( tmp
, GWL_STYLE
) & WS_GROUP
) hwnd
= tmp
;
1991 if (tmp
== hwndCtrl
) break;
1994 if (hwnd
== hwndCtrl
) break;
1995 if ((GetWindowLongW( hwnd
, GWL_STYLE
) & (WS_VISIBLE
|WS_DISABLED
)) == WS_VISIBLE
)
1998 if (!fPrevious
) break;
2000 hwnd
= GetWindow( hwnd
, GW_HWNDNEXT
);
2006 /***********************************************************************
2007 * GetNextDlgTabItem (USER.228)
2009 HWND16 WINAPI
GetNextDlgTabItem16( HWND16 hwndDlg
, HWND16 hwndCtrl
,
2012 return (HWND16
)GetNextDlgTabItem( hwndDlg
, hwndCtrl
, fPrevious
);
2015 /***********************************************************************
2016 * DIALOG_GetNextTabItem
2018 * Helper for GetNextDlgTabItem
2020 static HWND
DIALOG_GetNextTabItem( HWND hwndMain
, HWND hwndDlg
, HWND hwndCtrl
, BOOL fPrevious
)
2024 UINT wndSearch
= fPrevious
? GW_HWNDPREV
: GW_HWNDNEXT
;
2026 HWND hChildFirst
= 0;
2030 hChildFirst
= GetWindow(hwndDlg
,GW_CHILD
);
2031 if(fPrevious
) hChildFirst
= GetWindow(hChildFirst
,GW_HWNDLAST
);
2035 HWND hParent
= GetParent(hwndCtrl
);
2036 BOOL bValid
= FALSE
;
2039 if(hParent
== hwndMain
)
2044 hParent
= GetParent(hParent
);
2048 hChildFirst
= GetWindow(hwndCtrl
,wndSearch
);
2051 if(GetParent(hwndCtrl
) != hwndMain
)
2052 hChildFirst
= GetWindow(GetParent(hwndCtrl
),wndSearch
);
2056 hChildFirst
= GetWindow(hwndCtrl
,GW_HWNDLAST
);
2058 hChildFirst
= GetWindow(hwndCtrl
,GW_HWNDFIRST
);
2068 dsStyle
= GetWindowLongA(hChildFirst
,GWL_STYLE
);
2069 exStyle
= GetWindowLongA(hChildFirst
,GWL_EXSTYLE
);
2070 if( (dsStyle
& DS_CONTROL
|| exStyle
& WS_EX_CONTROLPARENT
) && (dsStyle
& WS_VISIBLE
) && !(dsStyle
& WS_DISABLED
))
2075 else if( (dsStyle
& WS_TABSTOP
) && (dsStyle
& WS_VISIBLE
) && !(dsStyle
& WS_DISABLED
))
2077 hChildFirst
= GetWindow(hChildFirst
,wndSearch
);
2082 retWnd
= DIALOG_GetNextTabItem(hwndMain
,hChildFirst
,(HWND
)NULL
,fPrevious
);
2084 retWnd
= hChildFirst
;
2087 hChildFirst
= GetWindow(hChildFirst
,wndSearch
);
2089 if(!retWnd
&& hwndCtrl
)
2091 HWND hParent
= GetParent(hwndCtrl
);
2094 if(hParent
== hwndMain
) break;
2095 retWnd
= DIALOG_GetNextTabItem(hwndMain
,GetParent(hParent
),hParent
,fPrevious
);
2097 hParent
= GetParent(hParent
);
2100 retWnd
= DIALOG_GetNextTabItem(hwndMain
,hwndMain
,(HWND
)NULL
,fPrevious
);
2105 /***********************************************************************
2106 * GetNextDlgTabItem (USER32.@)
2108 HWND WINAPI
GetNextDlgTabItem( HWND hwndDlg
, HWND hwndCtrl
,
2111 return DIALOG_GetNextTabItem(hwndDlg
,hwndDlg
,hwndCtrl
,fPrevious
);
2114 /**********************************************************************
2115 * DIALOG_DlgDirSelect
2117 * Helper function for DlgDirSelect*
2119 static BOOL
DIALOG_DlgDirSelect( HWND hwnd
, LPSTR str
, INT len
,
2120 INT id
, BOOL unicode
, BOOL combo
)
2125 HWND listbox
= GetDlgItem( hwnd
, id
);
2127 TRACE("%04x '%s' %d\n", hwnd
, str
, id
);
2128 if (!listbox
) return FALSE
;
2130 item
= SendMessageA(listbox
, combo
? CB_GETCURSEL
: LB_GETCURSEL
, 0, 0 );
2131 if (item
== LB_ERR
) return FALSE
;
2132 size
= SendMessageA(listbox
, combo
? CB_GETLBTEXTLEN
: LB_GETTEXTLEN
, 0, 0 );
2133 if (size
== LB_ERR
) return FALSE
;
2135 if (!(buffer
= HeapAlloc( GetProcessHeap(), 0, size
+1 ))) return FALSE
;
2137 SendMessageA( listbox
, combo
? CB_GETLBTEXT
: LB_GETTEXT
, item
, (LPARAM
)buffer
);
2139 if ((ret
= (buffer
[0] == '['))) /* drive or directory */
2141 if (buffer
[1] == '-') /* drive */
2149 buffer
[strlen(buffer
)-1] = '\\';
2157 if (len
> 0 && !MultiByteToWideChar( CP_ACP
, 0, ptr
, -1, (LPWSTR
)str
, len
))
2158 ((LPWSTR
)str
)[len
-1] = 0;
2160 else lstrcpynA( str
, ptr
, len
);
2161 HeapFree( GetProcessHeap(), 0, buffer
);
2162 TRACE("Returning %d '%s'\n", ret
, str
);
2167 /**********************************************************************
2170 * Helper function for DlgDirList*
2172 static INT
DIALOG_DlgDirList( HWND hDlg
, LPSTR spec
, INT idLBox
,
2173 INT idStatic
, UINT attrib
, BOOL combo
)
2176 LPSTR orig_spec
= spec
;
2178 #define SENDMSG(msg,wparam,lparam) \
2179 ((attrib & DDL_POSTMSGS) ? PostMessageA( hwnd, msg, wparam, lparam ) \
2180 : SendMessageA( hwnd, msg, wparam, lparam ))
2182 TRACE("%04x '%s' %d %d %04x\n",
2183 hDlg
, spec
? spec
: "NULL", idLBox
, idStatic
, attrib
);
2185 /* If the path exists and is a directory, chdir to it */
2186 if (!spec
|| !spec
[0] || SetCurrentDirectoryA( spec
)) spec
= "*.*";
2191 if ((p2
= strrchr( p
, '\\' ))) p
= p2
;
2192 if ((p2
= strrchr( p
, '/' ))) p
= p2
;
2197 if (!SetCurrentDirectoryA( spec
))
2199 *p
= sep
; /* Restore the original spec */
2206 TRACE( "mask=%s\n", spec
);
2208 if (idLBox
&& ((hwnd
= GetDlgItem( hDlg
, idLBox
)) != 0))
2210 SENDMSG( combo
? CB_RESETCONTENT
: LB_RESETCONTENT
, 0, 0 );
2211 if (attrib
& DDL_DIRECTORY
)
2213 if (!(attrib
& DDL_EXCLUSIVE
))
2215 if (SENDMSG( combo
? CB_DIR
: LB_DIR
,
2216 attrib
& ~(DDL_DIRECTORY
| DDL_DRIVES
),
2217 (LPARAM
)spec
) == LB_ERR
)
2220 if (SENDMSG( combo
? CB_DIR
: LB_DIR
,
2221 (attrib
& (DDL_DIRECTORY
| DDL_DRIVES
)) | DDL_EXCLUSIVE
,
2222 (LPARAM
)"*.*" ) == LB_ERR
)
2227 if (SENDMSG( combo
? CB_DIR
: LB_DIR
, attrib
,
2228 (LPARAM
)spec
) == LB_ERR
)
2233 if (idStatic
&& ((hwnd
= GetDlgItem( hDlg
, idStatic
)) != 0))
2235 char temp
[MAX_PATH
];
2236 GetCurrentDirectoryA( sizeof(temp
), temp
);
2238 /* Can't use PostMessage() here, because the string is on the stack */
2239 SetDlgItemTextA( hDlg
, idStatic
, temp
);
2242 if (orig_spec
&& (spec
!= orig_spec
))
2244 /* Update the original file spec */
2246 while ((*orig_spec
++ = *p
++));
2254 /**********************************************************************
2255 * DIALOG_DlgDirListW
2257 * Helper function for DlgDirList*W
2259 static INT
DIALOG_DlgDirListW( HWND hDlg
, LPWSTR spec
, INT idLBox
,
2260 INT idStatic
, UINT attrib
, BOOL combo
)
2264 LPSTR specA
= HEAP_strdupWtoA( GetProcessHeap(), 0, spec
);
2265 INT ret
= DIALOG_DlgDirList( hDlg
, specA
, idLBox
, idStatic
,
2267 MultiByteToWideChar( CP_ACP
, 0, specA
, -1, spec
, 0x7fffffff );
2268 HeapFree( GetProcessHeap(), 0, specA
);
2271 return DIALOG_DlgDirList( hDlg
, NULL
, idLBox
, idStatic
, attrib
, combo
);
2275 /**********************************************************************
2276 * DlgDirSelect (USER.99)
2278 BOOL16 WINAPI
DlgDirSelect16( HWND16 hwnd
, LPSTR str
, INT16 id
)
2280 return DlgDirSelectEx16( hwnd
, str
, 128, id
);
2284 /**********************************************************************
2285 * DlgDirSelectComboBox (USER.194)
2287 BOOL16 WINAPI
DlgDirSelectComboBox16( HWND16 hwnd
, LPSTR str
, INT16 id
)
2289 return DlgDirSelectComboBoxEx16( hwnd
, str
, 128, id
);
2293 /**********************************************************************
2294 * DlgDirSelectEx (USER.422)
2296 BOOL16 WINAPI
DlgDirSelectEx16( HWND16 hwnd
, LPSTR str
, INT16 len
, INT16 id
)
2298 return DlgDirSelectExA( hwnd
, str
, len
, id
);
2302 /**********************************************************************
2303 * DlgDirSelectExA (USER32.@)
2305 BOOL WINAPI
DlgDirSelectExA( HWND hwnd
, LPSTR str
, INT len
, INT id
)
2307 return DIALOG_DlgDirSelect( hwnd
, str
, len
, id
, FALSE
, FALSE
);
2311 /**********************************************************************
2312 * DlgDirSelectExW (USER32.@)
2314 BOOL WINAPI
DlgDirSelectExW( HWND hwnd
, LPWSTR str
, INT len
, INT id
)
2316 return DIALOG_DlgDirSelect( hwnd
, (LPSTR
)str
, len
, id
, TRUE
, FALSE
);
2320 /**********************************************************************
2321 * DlgDirSelectComboBoxEx (USER.423)
2323 BOOL16 WINAPI
DlgDirSelectComboBoxEx16( HWND16 hwnd
, LPSTR str
, INT16 len
,
2326 return DlgDirSelectComboBoxExA( hwnd
, str
, len
, id
);
2330 /**********************************************************************
2331 * DlgDirSelectComboBoxExA (USER32.@)
2333 BOOL WINAPI
DlgDirSelectComboBoxExA( HWND hwnd
, LPSTR str
, INT len
,
2336 return DIALOG_DlgDirSelect( hwnd
, str
, len
, id
, FALSE
, TRUE
);
2340 /**********************************************************************
2341 * DlgDirSelectComboBoxExW (USER32.@)
2343 BOOL WINAPI
DlgDirSelectComboBoxExW( HWND hwnd
, LPWSTR str
, INT len
,
2346 return DIALOG_DlgDirSelect( hwnd
, (LPSTR
)str
, len
, id
, TRUE
, TRUE
);
2350 /**********************************************************************
2351 * DlgDirList (USER.100)
2353 INT16 WINAPI
DlgDirList16( HWND16 hDlg
, LPSTR spec
, INT16 idLBox
,
2354 INT16 idStatic
, UINT16 attrib
)
2356 /* according to Win16 docs, DDL_DRIVES should make DDL_EXCLUSIVE
2357 * be set automatically (this is different in Win32, and
2358 * DIALOG_DlgDirList sends Win32 messages to the control,
2360 if (attrib
& DDL_DRIVES
) attrib
|= DDL_EXCLUSIVE
;
2361 return DIALOG_DlgDirList( hDlg
, spec
, idLBox
, idStatic
, attrib
, FALSE
);
2365 /**********************************************************************
2366 * DlgDirListA (USER32.@)
2368 INT WINAPI
DlgDirListA( HWND hDlg
, LPSTR spec
, INT idLBox
,
2369 INT idStatic
, UINT attrib
)
2371 return DIALOG_DlgDirList( hDlg
, spec
, idLBox
, idStatic
, attrib
, FALSE
);
2375 /**********************************************************************
2376 * DlgDirListW (USER32.@)
2378 INT WINAPI
DlgDirListW( HWND hDlg
, LPWSTR spec
, INT idLBox
,
2379 INT idStatic
, UINT attrib
)
2381 return DIALOG_DlgDirListW( hDlg
, spec
, idLBox
, idStatic
, attrib
, FALSE
);
2385 /**********************************************************************
2386 * DlgDirListComboBox (USER.195)
2388 INT16 WINAPI
DlgDirListComboBox16( HWND16 hDlg
, LPSTR spec
, INT16 idCBox
,
2389 INT16 idStatic
, UINT16 attrib
)
2391 return DIALOG_DlgDirList( hDlg
, spec
, idCBox
, idStatic
, attrib
, TRUE
);
2395 /**********************************************************************
2396 * DlgDirListComboBoxA (USER32.@)
2398 INT WINAPI
DlgDirListComboBoxA( HWND hDlg
, LPSTR spec
, INT idCBox
,
2399 INT idStatic
, UINT attrib
)
2401 return DIALOG_DlgDirList( hDlg
, spec
, idCBox
, idStatic
, attrib
, TRUE
);
2405 /**********************************************************************
2406 * DlgDirListComboBoxW (USER32.@)
2408 INT WINAPI
DlgDirListComboBoxW( HWND hDlg
, LPWSTR spec
, INT idCBox
,
2409 INT idStatic
, UINT attrib
)
2411 return DIALOG_DlgDirListW( hDlg
, spec
, idCBox
, idStatic
, attrib
, TRUE
);