2 * 16-bit dialog functions
4 * Copyright 1993, 1994, 1996, 2003 Alexandre Julliard
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 #include "wine/port.h"
29 #include "wine/winuser16.h"
30 #include "user_private.h"
31 #include "wine/debug.h"
33 WINE_DEFAULT_DEBUG_CHANNEL(dialog
);
35 /* Dialog control information */
65 #define DIALOG_CLASS_ATOM MAKEINTATOM(32770)
67 /***********************************************************************
70 * Helper function for modal dialogs to enable again the
71 * owner of the dialog box.
73 static void DIALOG_EnableOwner( HWND hOwner
)
75 /* Owner must be a top-level window */
77 hOwner
= GetAncestor( hOwner
, GA_ROOT
);
79 EnableWindow( hOwner
, TRUE
);
83 /***********************************************************************
86 * Helper function for modal dialogs to disable the
87 * owner of the dialog box. Returns TRUE if owner was enabled.
89 static BOOL
DIALOG_DisableOwner( HWND hOwner
)
91 /* Owner must be a top-level window */
93 hOwner
= GetAncestor( hOwner
, GA_ROOT
);
94 if (!hOwner
) return FALSE
;
95 if (IsWindowEnabled( hOwner
))
97 EnableWindow( hOwner
, FALSE
);
105 /***********************************************************************
106 * DIALOG_GetControl16
108 * Return the class and text of the control pointed to by ptr,
109 * fill the header structure and return a pointer to the next control.
111 static LPCSTR
DIALOG_GetControl16( LPCSTR p
, DLG_CONTROL_INFO
*info
)
113 static char buffer
[10];
116 info
->x
= GET_WORD(p
); p
+= sizeof(WORD
);
117 info
->y
= GET_WORD(p
); p
+= sizeof(WORD
);
118 info
->cx
= GET_WORD(p
); p
+= sizeof(WORD
);
119 info
->cy
= GET_WORD(p
); p
+= sizeof(WORD
);
120 info
->id
= GET_WORD(p
); p
+= sizeof(WORD
);
121 info
->style
= GET_DWORD(p
); p
+= sizeof(DWORD
);
127 case 0x80: strcpy( buffer
, "BUTTON" ); break;
128 case 0x81: strcpy( buffer
, "EDIT" ); break;
129 case 0x82: strcpy( buffer
, "STATIC" ); break;
130 case 0x83: strcpy( buffer
, "LISTBOX" ); break;
131 case 0x84: strcpy( buffer
, "SCROLLBAR" ); break;
132 case 0x85: strcpy( buffer
, "COMBOBOX" ); break;
133 default: buffer
[0] = '\0'; break;
135 info
->className
= buffer
;
144 int_id
= ((BYTE
)*p
== 0xff);
147 /* Integer id, not documented (?). Only works for SS_ICON controls */
148 info
->windowName
= MAKEINTRESOURCEA(GET_WORD(p
+1));
153 info
->windowName
= p
;
157 if (*p
) info
->data
= p
+ 1;
158 else info
->data
= NULL
;
162 TRACE(" %s %s %d, %d, %d, %d, %d, %08x, %p\n",
163 debugstr_a(info
->className
), debugstr_a(info
->windowName
),
164 info
->id
, info
->x
, info
->y
, info
->cx
, info
->cy
,
165 info
->style
, info
->data
);
171 /***********************************************************************
172 * DIALOG_CreateControls16
174 * Create the control windows for a dialog.
176 static BOOL
DIALOG_CreateControls16( HWND hwnd
, LPCSTR
template,
177 const DLG_TEMPLATE
*dlgTemplate
, HINSTANCE16 hInst
)
179 DIALOGINFO
*dlgInfo
= wow_handlers32
.get_dialog_info( hwnd
, TRUE
);
180 DLG_CONTROL_INFO info
;
181 HWND hwndCtrl
, hwndDefButton
= 0;
182 INT items
= dlgTemplate
->nbItems
;
187 HINSTANCE16 instance
= hInst
;
190 template = DIALOG_GetControl16( template, &info
);
191 segptr
= MapLS( info
.data
);
192 hwndCtrl
= WIN_Handle32( CreateWindowEx16( WS_EX_NOPARENTNOTIFY
,
193 info
.className
, info
.windowName
,
194 info
.style
| WS_CHILD
,
195 MulDiv(info
.x
, dlgInfo
->xBaseUnit
, 4),
196 MulDiv(info
.y
, dlgInfo
->yBaseUnit
, 8),
197 MulDiv(info
.cx
, dlgInfo
->xBaseUnit
, 4),
198 MulDiv(info
.cy
, dlgInfo
->yBaseUnit
, 8),
199 HWND_16(hwnd
), (HMENU16
)info
.id
,
200 instance
, (LPVOID
)segptr
));
205 if (dlgTemplate
->style
& DS_NOFAILCREATE
) continue;
209 /* Send initialisation messages to the control */
210 if (dlgInfo
->hUserFont
) SendMessageA( hwndCtrl
, WM_SETFONT
,
211 (WPARAM
)dlgInfo
->hUserFont
, 0 );
212 if (SendMessageA(hwndCtrl
, WM_GETDLGCODE
, 0, 0) & DLGC_DEFPUSHBUTTON
)
214 /* If there's already a default push-button, set it back */
215 /* to normal and use this one instead. */
217 SendMessageA( hwndDefButton
, BM_SETSTYLE
,
218 BS_PUSHBUTTON
,FALSE
);
219 hwndDefButton
= hwndCtrl
;
220 dlgInfo
->idResult
= GetWindowLongPtrA( hwndCtrl
, GWLP_ID
);
228 /***********************************************************************
229 * DIALOG_ParseTemplate16
231 * Fill a DLG_TEMPLATE structure from the dialog template, and return
232 * a pointer to the first control.
234 static LPCSTR
DIALOG_ParseTemplate16( LPCSTR p
, DLG_TEMPLATE
* result
)
236 result
->style
= GET_DWORD(p
); p
+= sizeof(DWORD
);
237 result
->nbItems
= (unsigned char) *p
++;
238 result
->x
= GET_WORD(p
); p
+= sizeof(WORD
);
239 result
->y
= GET_WORD(p
); p
+= sizeof(WORD
);
240 result
->cx
= GET_WORD(p
); p
+= sizeof(WORD
);
241 result
->cy
= GET_WORD(p
); p
+= sizeof(WORD
);
243 TRACE("DIALOG %d, %d, %d, %d\n", result
->x
, result
->y
, result
->cx
, result
->cy
);
244 TRACE(" STYLE %08x\n", result
->style
);
246 /* Get the menu name */
251 result
->menuName
= 0;
255 result
->menuName
= MAKEINTRESOURCEA(GET_WORD( p
+ 1 ));
257 TRACE(" MENU %04x\n", LOWORD(result
->menuName
) );
260 result
->menuName
= p
;
261 TRACE(" MENU '%s'\n", p
);
266 /* Get the class name */
270 result
->className
= p
;
271 TRACE(" CLASS '%s'\n", result
->className
);
273 else result
->className
= (LPCSTR
)DIALOG_CLASS_ATOM
;
276 /* Get the window caption */
280 TRACE(" CAPTION '%s'\n", result
->caption
);
282 /* Get the font name */
284 result
->pointSize
= 0;
285 result
->faceName
= NULL
;
287 if (result
->style
& DS_SETFONT
)
289 result
->pointSize
= GET_WORD(p
);
291 result
->faceName
= p
;
293 TRACE(" FONT %d,'%s'\n", result
->pointSize
, result
->faceName
);
299 /***********************************************************************
300 * DIALOG_CreateIndirect16
302 * Creates a dialog box window
304 * modal = TRUE if we are called from a modal dialog box.
305 * (it's more compatible to do it here, as under Windows the owner
306 * is never disabled if the dialog fails because of an invalid template)
308 static HWND
DIALOG_CreateIndirect16( HINSTANCE16 hInst
, LPCVOID dlgTemplate
,
309 HWND owner
, DLGPROC16 dlgProc
, LPARAM param
,
316 DLG_TEMPLATE
template;
317 DIALOGINFO
* dlgInfo
;
318 BOOL ownerEnabled
= TRUE
;
320 DWORD units
= GetDialogBaseUnits();
324 UINT xBaseUnit
= LOWORD(units
);
325 UINT yBaseUnit
= HIWORD(units
);
327 /* Parse dialog template */
329 dlgTemplate
= DIALOG_ParseTemplate16( dlgTemplate
, &template );
333 if (template.menuName
) hMenu
= LoadMenu16( hInst
, template.menuName
);
335 /* Create custom font if needed */
337 if (template.style
& DS_SETFONT
)
339 /* We convert the size to pixels and then make it -ve. This works
340 * for both +ve and -ve template.pointSize */
344 pixels
= MulDiv(template.pointSize
, GetDeviceCaps(dc
, LOGPIXELSY
), 72);
345 hUserFont
= CreateFontA( -pixels
, 0, 0, 0, FW_DONTCARE
,
346 FALSE
, FALSE
, FALSE
, DEFAULT_CHARSET
, 0, 0,
347 PROOF_QUALITY
, FF_DONTCARE
, template.faceName
);
351 HFONT hOldFont
= SelectObject( dc
, hUserFont
);
352 charSize
.cx
= GdiGetCharDimensions( dc
, NULL
, &charSize
.cy
);
355 xBaseUnit
= charSize
.cx
;
356 yBaseUnit
= charSize
.cy
;
358 SelectObject( dc
, hOldFont
);
361 TRACE("units = %d,%d\n", xBaseUnit
, yBaseUnit
);
364 /* Create dialog main window */
366 rect
.left
= rect
.top
= 0;
367 rect
.right
= MulDiv(template.cx
, xBaseUnit
, 4);
368 rect
.bottom
= MulDiv(template.cy
, yBaseUnit
, 8);
369 if (template.style
& DS_MODALFRAME
) exStyle
|= WS_EX_DLGMODALFRAME
;
370 AdjustWindowRectEx( &rect
, template.style
, (hMenu
!= 0), exStyle
);
373 size
.cx
= rect
.right
- rect
.left
;
374 size
.cy
= rect
.bottom
- rect
.top
;
376 if (template.x
== CW_USEDEFAULT16
)
378 pos
.x
= pos
.y
= CW_USEDEFAULT16
;
382 HMONITOR monitor
= 0;
383 MONITORINFO mon_info
;
385 mon_info
.cbSize
= sizeof(mon_info
);
386 if (template.style
& DS_CENTER
)
388 monitor
= MonitorFromWindow( owner
? owner
: GetActiveWindow(), MONITOR_DEFAULTTOPRIMARY
);
389 GetMonitorInfoW( monitor
, &mon_info
);
390 pos
.x
= (mon_info
.rcWork
.left
+ mon_info
.rcWork
.right
- size
.cx
) / 2;
391 pos
.y
= (mon_info
.rcWork
.top
+ mon_info
.rcWork
.bottom
- size
.cy
) / 2;
393 else if (template.style
& DS_CENTERMOUSE
)
395 GetCursorPos( &pos
);
396 monitor
= MonitorFromPoint( pos
, MONITOR_DEFAULTTOPRIMARY
);
397 GetMonitorInfoW( monitor
, &mon_info
);
401 pos
.x
+= MulDiv(template.x
, xBaseUnit
, 4);
402 pos
.y
+= MulDiv(template.y
, yBaseUnit
, 8);
403 if (!(template.style
& (WS_CHILD
|DS_ABSALIGN
))) ClientToScreen( owner
, &pos
);
405 if ( !(template.style
& WS_CHILD
) )
409 /* try to fit it into the desktop */
413 SetRect( &rect
, pos
.x
, pos
.y
, pos
.x
+ size
.cx
, pos
.y
+ size
.cy
);
414 monitor
= MonitorFromRect( &rect
, MONITOR_DEFAULTTOPRIMARY
);
415 GetMonitorInfoW( monitor
, &mon_info
);
417 if ((dX
= pos
.x
+ size
.cx
+ GetSystemMetrics(SM_CXDLGFRAME
) - mon_info
.rcWork
.right
) > 0)
419 if ((dY
= pos
.y
+ size
.cy
+ GetSystemMetrics(SM_CYDLGFRAME
) - mon_info
.rcWork
.bottom
) > 0)
421 if( pos
.x
< mon_info
.rcWork
.left
) pos
.x
= mon_info
.rcWork
.left
;
422 if( pos
.y
< mon_info
.rcWork
.top
) pos
.y
= mon_info
.rcWork
.top
;
428 ownerEnabled
= DIALOG_DisableOwner( owner
);
429 if (ownerEnabled
) flags
|= DF_OWNERENABLED
;
432 hwnd
= WIN_Handle32( CreateWindowEx16(exStyle
, template.className
,
433 template.caption
, template.style
& ~WS_VISIBLE
,
434 pos
.x
, pos
.y
, size
.cx
, size
.cy
,
435 HWND_16(owner
), hMenu
, hInst
, NULL
));
438 if (hUserFont
) DeleteObject( hUserFont
);
439 if (hMenu
) DestroyMenu16( hMenu
);
440 if (modal
&& (flags
& DF_OWNERENABLED
)) DIALOG_EnableOwner(owner
);
443 dlgInfo
= wow_handlers32
.get_dialog_info( hwnd
, TRUE
);
444 dlgInfo
->hwndFocus
= 0;
445 dlgInfo
->hUserFont
= hUserFont
;
446 dlgInfo
->hMenu
= HMENU_32( hMenu
);
447 dlgInfo
->xBaseUnit
= xBaseUnit
;
448 dlgInfo
->yBaseUnit
= yBaseUnit
;
449 dlgInfo
->idResult
= 0;
450 dlgInfo
->flags
= flags
;
452 SetWindowLong16( HWND_16(hwnd
), DWLP_DLGPROC
, (LONG
)dlgProc
);
455 SendMessageA( hwnd
, WM_SETFONT
, (WPARAM
)hUserFont
, 0 );
457 /* Create controls */
459 if (DIALOG_CreateControls16( hwnd
, dlgTemplate
, &template, hInst
))
461 HWND hwndPreInitFocus
;
463 /* Send initialisation messages and set focus */
465 dlgInfo
->hwndFocus
= GetNextDlgTabItem( hwnd
, 0, FALSE
);
467 hwndPreInitFocus
= GetFocus();
468 if (SendMessageA( hwnd
, WM_INITDIALOG
, (WPARAM
)dlgInfo
->hwndFocus
, param
))
470 /* check where the focus is again,
471 * some controls status might have changed in WM_INITDIALOG */
472 dlgInfo
->hwndFocus
= GetNextDlgTabItem( hwnd
, 0, FALSE
);
473 if( dlgInfo
->hwndFocus
)
474 SetFocus( dlgInfo
->hwndFocus
);
478 /* If the dlgproc has returned FALSE (indicating handling of keyboard focus)
479 but the focus has not changed, set the focus where we expect it. */
480 if ((GetFocus() == hwndPreInitFocus
) &&
481 (GetWindowLongW( hwnd
, GWL_STYLE
) & WS_VISIBLE
))
483 dlgInfo
->hwndFocus
= GetNextDlgTabItem( hwnd
, 0, FALSE
);
484 if( dlgInfo
->hwndFocus
)
485 SetFocus( dlgInfo
->hwndFocus
);
489 if (template.style
& WS_VISIBLE
&& !(GetWindowLongW( hwnd
, GWL_STYLE
) & WS_VISIBLE
))
491 ShowWindow( hwnd
, SW_SHOWNORMAL
); /* SW_SHOW doesn't always work */
495 if( IsWindow(hwnd
) ) DestroyWindow( hwnd
);
496 if (modal
&& ownerEnabled
) DIALOG_EnableOwner(owner
);
501 /***********************************************************************
502 * DialogBox (USER.87)
504 INT16 WINAPI
DialogBox16( HINSTANCE16 hInst
, LPCSTR dlgTemplate
,
505 HWND16 owner
, DLGPROC16 dlgProc
)
507 return DialogBoxParam16( hInst
, dlgTemplate
, owner
, dlgProc
, 0 );
511 /**************************************************************************
512 * EndDialog (USER.88)
514 BOOL16 WINAPI
EndDialog16( HWND16 hwnd
, INT16 retval
)
516 return EndDialog( WIN_Handle32(hwnd
), retval
);
520 /***********************************************************************
521 * CreateDialog (USER.89)
523 HWND16 WINAPI
CreateDialog16( HINSTANCE16 hInst
, LPCSTR dlgTemplate
,
524 HWND16 owner
, DLGPROC16 dlgProc
)
526 return CreateDialogParam16( hInst
, dlgTemplate
, owner
, dlgProc
, 0 );
530 /**************************************************************************
531 * GetDlgItem (USER.91)
533 HWND16 WINAPI
GetDlgItem16( HWND16 hwndDlg
, INT16 id
)
535 return HWND_16( GetDlgItem( WIN_Handle32(hwndDlg
), (UINT16
) id
));
539 /**************************************************************************
540 * SetDlgItemText (USER.92)
542 void WINAPI
SetDlgItemText16( HWND16 hwnd
, INT16 id
, SEGPTR lpString
)
544 SendDlgItemMessage16( hwnd
, id
, WM_SETTEXT
, 0, lpString
);
548 /**************************************************************************
549 * GetDlgItemText (USER.93)
551 INT16 WINAPI
GetDlgItemText16( HWND16 hwnd
, INT16 id
, SEGPTR str
, UINT16 len
)
553 return SendDlgItemMessage16( hwnd
, id
, WM_GETTEXT
, len
, str
);
557 /**************************************************************************
558 * SetDlgItemInt (USER.94)
560 void WINAPI
SetDlgItemInt16( HWND16 hwnd
, INT16 id
, UINT16 value
, BOOL16 fSigned
)
562 SetDlgItemInt( WIN_Handle32(hwnd
), (UINT
)(UINT16
)id
,
563 (UINT
)(fSigned
? (INT16
) value
: value
), fSigned
);
567 /**************************************************************************
568 * GetDlgItemInt (USER.95)
570 UINT16 WINAPI
GetDlgItemInt16( HWND16 hwnd
, INT16 id
, BOOL16
*translated
, BOOL16 fSigned
)
575 if (translated
) *translated
= FALSE
;
576 result
= GetDlgItemInt( WIN_Handle32(hwnd
), (UINT
)(UINT16
)id
, &ok
, fSigned
);
580 if (((INT
)result
< -32767) || ((INT
)result
> 32767)) return 0;
584 if (result
> 65535) return 0;
586 if (translated
) *translated
= TRUE
;
587 return (UINT16
)result
;
591 /**************************************************************************
592 * CheckRadioButton (USER.96)
594 BOOL16 WINAPI
CheckRadioButton16( HWND16 hwndDlg
, UINT16 firstID
,
595 UINT16 lastID
, UINT16 checkID
)
597 return CheckRadioButton( WIN_Handle32(hwndDlg
), firstID
, lastID
, checkID
);
601 /**************************************************************************
602 * CheckDlgButton (USER.97)
604 BOOL16 WINAPI
CheckDlgButton16( HWND16 hwnd
, INT16 id
, UINT16 check
)
606 SendDlgItemMessage16( hwnd
, id
, BM_SETCHECK16
, check
, 0 );
611 /**************************************************************************
612 * IsDlgButtonChecked (USER.98)
614 UINT16 WINAPI
IsDlgButtonChecked16( HWND16 hwnd
, UINT16 id
)
616 return (UINT16
)SendDlgItemMessage16( hwnd
, id
, BM_GETCHECK16
, 0, 0 );
620 /**************************************************************************
621 * DlgDirSelect (USER.99)
623 BOOL16 WINAPI
DlgDirSelect16( HWND16 hwnd
, LPSTR str
, INT16 id
)
625 return DlgDirSelectEx16( hwnd
, str
, 128, id
);
629 /**************************************************************************
630 * DlgDirList (USER.100)
632 INT16 WINAPI
DlgDirList16( HWND16 hDlg
, LPSTR spec
, INT16 idLBox
,
633 INT16 idStatic
, UINT16 attrib
)
635 /* according to Win16 docs, DDL_DRIVES should make DDL_EXCLUSIVE
636 * be set automatically (this is different in Win32, and
637 * DIALOG_DlgDirList sends Win32 messages to the control,
639 if (attrib
& DDL_DRIVES
) attrib
|= DDL_EXCLUSIVE
;
640 return DlgDirListA( WIN_Handle32(hDlg
), spec
, idLBox
, idStatic
, attrib
);
644 /**************************************************************************
645 * SendDlgItemMessage (USER.101)
647 LRESULT WINAPI
SendDlgItemMessage16( HWND16 hwnd
, INT16 id
, UINT16 msg
,
648 WPARAM16 wParam
, LPARAM lParam
)
650 HWND16 hwndCtrl
= GetDlgItem16( hwnd
, id
);
651 if (hwndCtrl
) return SendMessage16( hwndCtrl
, msg
, wParam
, lParam
);
656 /**************************************************************************
657 * MapDialogRect (USER.103)
659 void WINAPI
MapDialogRect16( HWND16 hwnd
, LPRECT16 rect
)
661 RECT rect32
= { rect
->left
, rect
->top
, rect
->right
, rect
->bottom
};
662 MapDialogRect( WIN_Handle32(hwnd
), &rect32
);
663 rect
->left
= rect32
.left
;
664 rect
->right
= rect32
.right
;
665 rect
->top
= rect32
.top
;
666 rect
->bottom
= rect32
.bottom
;
670 /**************************************************************************
671 * DlgDirSelectComboBox (USER.194)
673 BOOL16 WINAPI
DlgDirSelectComboBox16( HWND16 hwnd
, LPSTR str
, INT16 id
)
675 return DlgDirSelectComboBoxEx16( hwnd
, str
, 128, id
);
679 /**************************************************************************
680 * DlgDirListComboBox (USER.195)
682 INT16 WINAPI
DlgDirListComboBox16( HWND16 hDlg
, LPSTR spec
, INT16 idCBox
,
683 INT16 idStatic
, UINT16 attrib
)
685 return DlgDirListComboBoxA( WIN_Handle32(hDlg
), spec
, idCBox
, idStatic
, attrib
);
689 /***********************************************************************
690 * DialogBoxIndirect (USER.218)
692 INT16 WINAPI
DialogBoxIndirect16( HINSTANCE16 hInst
, HANDLE16 dlgTemplate
,
693 HWND16 owner
, DLGPROC16 dlgProc
)
695 return DialogBoxIndirectParam16( hInst
, dlgTemplate
, owner
, dlgProc
, 0 );
699 /***********************************************************************
700 * CreateDialogIndirect (USER.219)
702 HWND16 WINAPI
CreateDialogIndirect16( HINSTANCE16 hInst
, LPCVOID dlgTemplate
,
703 HWND16 owner
, DLGPROC16 dlgProc
)
705 return CreateDialogIndirectParam16( hInst
, dlgTemplate
, owner
, dlgProc
, 0);
709 /**************************************************************************
710 * GetNextDlgGroupItem (USER.227)
712 HWND16 WINAPI
GetNextDlgGroupItem16( HWND16 hwndDlg
, HWND16 hwndCtrl
,
715 return HWND_16( GetNextDlgGroupItem( WIN_Handle32(hwndDlg
), WIN_Handle32(hwndCtrl
), fPrevious
));
719 /**************************************************************************
720 * GetNextDlgTabItem (USER.228)
722 HWND16 WINAPI
GetNextDlgTabItem16( HWND16 hwndDlg
, HWND16 hwndCtrl
,
725 return HWND_16( GetNextDlgTabItem( WIN_Handle32(hwndDlg
), WIN_Handle32(hwndCtrl
), fPrevious
));
729 /***********************************************************************
730 * DialogBoxParam (USER.239)
732 INT16 WINAPI
DialogBoxParam16( HINSTANCE16 hInst
, LPCSTR
template,
733 HWND16 owner16
, DLGPROC16 dlgProc
, LPARAM param
)
741 if (!(hRsrc
= FindResource16( hInst
, template, (LPSTR
)RT_DIALOG
))) return 0;
742 if (!(hmem
= LoadResource16( hInst
, hRsrc
))) return 0;
743 if ((data
= LockResource16( hmem
)))
745 HWND owner
= WIN_Handle32(owner16
);
746 hwnd
= DIALOG_CreateIndirect16( hInst
, data
, owner
, dlgProc
, param
, TRUE
);
747 if (hwnd
) ret
= wow_handlers32
.dialog_box_loop( hwnd
, owner
);
748 GlobalUnlock16( hmem
);
750 FreeResource16( hmem
);
755 /***********************************************************************
756 * DialogBoxIndirectParam (USER.240)
758 INT16 WINAPI
DialogBoxIndirectParam16( HINSTANCE16 hInst
, HANDLE16 dlgTemplate
,
759 HWND16 owner16
, DLGPROC16 dlgProc
, LPARAM param
)
761 HWND hwnd
, owner
= WIN_Handle32( owner16
);
764 if (!(ptr
= GlobalLock16( dlgTemplate
))) return -1;
765 hwnd
= DIALOG_CreateIndirect16( hInst
, ptr
, owner
, dlgProc
, param
, TRUE
);
766 GlobalUnlock16( dlgTemplate
);
767 if (hwnd
) return wow_handlers32
.dialog_box_loop( hwnd
, owner
);
772 /***********************************************************************
773 * CreateDialogParam (USER.241)
775 HWND16 WINAPI
CreateDialogParam16( HINSTANCE16 hInst
, LPCSTR dlgTemplate
,
776 HWND16 owner
, DLGPROC16 dlgProc
, LPARAM param
)
783 TRACE("%04x,%s,%04x,%p,%ld\n",
784 hInst
, debugstr_a(dlgTemplate
), owner
, dlgProc
, param
);
786 if (!(hRsrc
= FindResource16( hInst
, dlgTemplate
, (LPSTR
)RT_DIALOG
))) return 0;
787 if (!(hmem
= LoadResource16( hInst
, hRsrc
))) return 0;
788 if (!(data
= LockResource16( hmem
))) hwnd
= 0;
789 else hwnd
= CreateDialogIndirectParam16( hInst
, data
, owner
, dlgProc
, param
);
790 FreeResource16( hmem
);
795 /***********************************************************************
796 * CreateDialogIndirectParam (USER.242)
798 HWND16 WINAPI
CreateDialogIndirectParam16( HINSTANCE16 hInst
, LPCVOID dlgTemplate
,
799 HWND16 owner
, DLGPROC16 dlgProc
, LPARAM param
)
801 if (!dlgTemplate
) return 0;
802 return HWND_16( DIALOG_CreateIndirect16( hInst
, dlgTemplate
, WIN_Handle32(owner
),
803 dlgProc
, param
, FALSE
));
807 /**************************************************************************
808 * DlgDirSelectEx (USER.422)
810 BOOL16 WINAPI
DlgDirSelectEx16( HWND16 hwnd
, LPSTR str
, INT16 len
, INT16 id
)
812 return DlgDirSelectExA( WIN_Handle32(hwnd
), str
, len
, id
);
816 /**************************************************************************
817 * DlgDirSelectComboBoxEx (USER.423)
819 BOOL16 WINAPI
DlgDirSelectComboBoxEx16( HWND16 hwnd
, LPSTR str
, INT16 len
,
822 return DlgDirSelectComboBoxExA( WIN_Handle32(hwnd
), str
, len
, id
);