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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #include "wine/port.h"
29 #include "wine/winuser16.h"
32 #include "user_private.h"
33 #include "wine/debug.h"
35 WINE_DEFAULT_DEBUG_CHANNEL(dialog
);
37 /* Dialog control information */
68 /***********************************************************************
71 * Return the class and text of the control pointed to by ptr,
72 * fill the header structure and return a pointer to the next control.
74 static LPCSTR
DIALOG_GetControl16( LPCSTR p
, DLG_CONTROL_INFO
*info
)
76 static char buffer
[10];
79 info
->x
= GET_WORD(p
); p
+= sizeof(WORD
);
80 info
->y
= GET_WORD(p
); p
+= sizeof(WORD
);
81 info
->cx
= GET_WORD(p
); p
+= sizeof(WORD
);
82 info
->cy
= GET_WORD(p
); p
+= sizeof(WORD
);
83 info
->id
= GET_WORD(p
); p
+= sizeof(WORD
);
84 info
->style
= GET_DWORD(p
); p
+= sizeof(DWORD
);
90 case 0x80: strcpy( buffer
, "BUTTON" ); break;
91 case 0x81: strcpy( buffer
, "EDIT" ); break;
92 case 0x82: strcpy( buffer
, "STATIC" ); break;
93 case 0x83: strcpy( buffer
, "LISTBOX" ); break;
94 case 0x84: strcpy( buffer
, "SCROLLBAR" ); break;
95 case 0x85: strcpy( buffer
, "COMBOBOX" ); break;
96 default: buffer
[0] = '\0'; break;
98 info
->className
= buffer
;
107 int_id
= ((BYTE
)*p
== 0xff);
110 /* Integer id, not documented (?). Only works for SS_ICON controls */
111 info
->windowName
= MAKEINTRESOURCEA(GET_WORD(p
+1));
116 info
->windowName
= p
;
120 if (*p
) info
->data
= p
+ 1;
121 else info
->data
= NULL
;
125 TRACE(" %s %s %d, %d, %d, %d, %d, %08lx, %p\n",
126 debugstr_a(info
->className
), debugstr_a(info
->windowName
),
127 info
->id
, info
->x
, info
->y
, info
->cx
, info
->cy
,
128 info
->style
, info
->data
);
134 /***********************************************************************
135 * DIALOG_CreateControls16
137 * Create the control windows for a dialog.
139 static BOOL
DIALOG_CreateControls16( HWND hwnd
, LPCSTR
template,
140 const DLG_TEMPLATE
*dlgTemplate
, HINSTANCE16 hInst
)
142 DIALOGINFO
*dlgInfo
= DIALOG_get_info( hwnd
, TRUE
);
143 DLG_CONTROL_INFO info
;
144 HWND hwndCtrl
, hwndDefButton
= 0;
145 INT items
= dlgTemplate
->nbItems
;
150 HINSTANCE16 instance
= hInst
;
153 template = DIALOG_GetControl16( template, &info
);
154 if (HIWORD(info
.className
) && !strcmp( info
.className
, "EDIT") &&
155 !(GetWindowLongW( hwnd
, GWL_STYLE
) & DS_LOCALEDIT
))
157 if (!dlgInfo
->hDialogHeap
)
159 dlgInfo
->hDialogHeap
= GlobalAlloc16(GMEM_FIXED
, 0x10000);
160 if (!dlgInfo
->hDialogHeap
)
162 ERR("Insufficient memory to create heap for edit control\n" );
165 LocalInit16(dlgInfo
->hDialogHeap
, 0, 0xffff);
167 instance
= dlgInfo
->hDialogHeap
;
170 segptr
= MapLS( info
.data
);
171 hwndCtrl
= WIN_Handle32( CreateWindowEx16( WS_EX_NOPARENTNOTIFY
,
172 info
.className
, info
.windowName
,
173 info
.style
| WS_CHILD
,
174 MulDiv(info
.x
, dlgInfo
->xBaseUnit
, 4),
175 MulDiv(info
.y
, dlgInfo
->yBaseUnit
, 8),
176 MulDiv(info
.cx
, dlgInfo
->xBaseUnit
, 4),
177 MulDiv(info
.cy
, dlgInfo
->yBaseUnit
, 8),
178 HWND_16(hwnd
), (HMENU16
)info
.id
,
179 instance
, (LPVOID
)segptr
));
184 if (dlgTemplate
->style
& DS_NOFAILCREATE
) continue;
188 /* Send initialisation messages to the control */
189 if (dlgInfo
->hUserFont
) SendMessageA( hwndCtrl
, WM_SETFONT
,
190 (WPARAM
)dlgInfo
->hUserFont
, 0 );
191 if (SendMessageA(hwndCtrl
, WM_GETDLGCODE
, 0, 0) & DLGC_DEFPUSHBUTTON
)
193 /* If there's already a default push-button, set it back */
194 /* to normal and use this one instead. */
196 SendMessageA( hwndDefButton
, BM_SETSTYLE
,
197 BS_PUSHBUTTON
,FALSE
);
198 hwndDefButton
= hwndCtrl
;
199 dlgInfo
->idResult
= GetWindowLongPtrA( hwndCtrl
, GWLP_ID
);
207 /***********************************************************************
208 * DIALOG_ParseTemplate16
210 * Fill a DLG_TEMPLATE structure from the dialog template, and return
211 * a pointer to the first control.
213 static LPCSTR
DIALOG_ParseTemplate16( LPCSTR p
, DLG_TEMPLATE
* result
)
215 result
->style
= GET_DWORD(p
); p
+= sizeof(DWORD
);
216 result
->nbItems
= (unsigned char) *p
++;
217 result
->x
= GET_WORD(p
); p
+= sizeof(WORD
);
218 result
->y
= GET_WORD(p
); p
+= sizeof(WORD
);
219 result
->cx
= GET_WORD(p
); p
+= sizeof(WORD
);
220 result
->cy
= GET_WORD(p
); p
+= sizeof(WORD
);
222 TRACE("DIALOG %d, %d, %d, %d\n", result
->x
, result
->y
, result
->cx
, result
->cy
);
223 TRACE(" STYLE %08lx\n", result
->style
);
225 /* Get the menu name */
230 result
->menuName
= 0;
234 result
->menuName
= MAKEINTRESOURCEA(GET_WORD( p
+ 1 ));
236 TRACE(" MENU %04x\n", LOWORD(result
->menuName
) );
239 result
->menuName
= p
;
240 TRACE(" MENU '%s'\n", p
);
245 /* Get the class name */
249 result
->className
= p
;
250 TRACE(" CLASS '%s'\n", result
->className
);
252 else result
->className
= DIALOG_CLASS_ATOMA
;
255 /* Get the window caption */
259 TRACE(" CAPTION '%s'\n", result
->caption
);
261 /* Get the font name */
263 result
->pointSize
= 0;
264 result
->faceName
= NULL
;
266 if (result
->style
& DS_SETFONT
)
268 result
->pointSize
= GET_WORD(p
);
270 result
->faceName
= p
;
272 TRACE(" FONT %d,'%s'\n", result
->pointSize
, result
->faceName
);
278 /***********************************************************************
279 * DIALOG_CreateIndirect16
281 * Creates a dialog box window
283 * modal = TRUE if we are called from a modal dialog box.
284 * (it's more compatible to do it here, as under Windows the owner
285 * is never disabled if the dialog fails because of an invalid template)
287 static HWND
DIALOG_CreateIndirect16( HINSTANCE16 hInst
, LPCVOID dlgTemplate
,
288 HWND owner
, DLGPROC16 dlgProc
, LPARAM param
,
294 DLG_TEMPLATE
template;
295 DIALOGINFO
* dlgInfo
;
296 BOOL ownerEnabled
= TRUE
;
298 DWORD units
= GetDialogBaseUnits();
300 /* Parse dialog template */
302 dlgTemplate
= DIALOG_ParseTemplate16( dlgTemplate
, &template );
304 /* Initialise dialog extra data */
306 if (!(dlgInfo
= HeapAlloc( GetProcessHeap(), 0, sizeof(*dlgInfo
) ))) return 0;
307 dlgInfo
->hwndFocus
= 0;
308 dlgInfo
->hUserFont
= 0;
310 dlgInfo
->xBaseUnit
= LOWORD(units
);
311 dlgInfo
->yBaseUnit
= HIWORD(units
);
312 dlgInfo
->idResult
= 0;
314 dlgInfo
->hDialogHeap
= 0;
318 if (template.menuName
)
320 dlgInfo
->hMenu
= HMENU_32(LoadMenu16( hInst
, template.menuName
));
323 /* Create custom font if needed */
325 if (template.style
& DS_SETFONT
)
327 /* We convert the size to pixels and then make it -ve. This works
328 * for both +ve and -ve template.pointSize */
332 pixels
= MulDiv(template.pointSize
, GetDeviceCaps(dc
, LOGPIXELSY
), 72);
333 dlgInfo
->hUserFont
= CreateFontA( -pixels
, 0, 0, 0, FW_DONTCARE
,
334 FALSE
, FALSE
, FALSE
, DEFAULT_CHARSET
, 0, 0,
335 PROOF_QUALITY
, FF_DONTCARE
, template.faceName
);
336 if (dlgInfo
->hUserFont
)
339 HFONT hOldFont
= SelectObject( dc
, dlgInfo
->hUserFont
);
340 charSize
.cx
= GdiGetCharDimensions( dc
, NULL
, &charSize
.cy
);
343 dlgInfo
->xBaseUnit
= charSize
.cx
;
344 dlgInfo
->yBaseUnit
= charSize
.cy
;
346 SelectObject( dc
, hOldFont
);
349 TRACE("units = %d,%d\n", dlgInfo
->xBaseUnit
, dlgInfo
->yBaseUnit
);
352 /* Create dialog main window */
354 rect
.left
= rect
.top
= 0;
355 rect
.right
= MulDiv(template.cx
, dlgInfo
->xBaseUnit
, 4);
356 rect
.bottom
= MulDiv(template.cy
, dlgInfo
->yBaseUnit
, 8);
357 if (template.style
& DS_MODALFRAME
) exStyle
|= WS_EX_DLGMODALFRAME
;
358 AdjustWindowRectEx( &rect
, template.style
, (dlgInfo
->hMenu
!= 0), exStyle
);
359 rect
.right
-= rect
.left
;
360 rect
.bottom
-= rect
.top
;
362 if (template.x
== CW_USEDEFAULT16
)
364 rect
.left
= rect
.top
= CW_USEDEFAULT16
;
368 if (template.style
& DS_CENTER
)
370 rect
.left
= (GetSystemMetrics(SM_CXSCREEN
) - rect
.right
) / 2;
371 rect
.top
= (GetSystemMetrics(SM_CYSCREEN
) - rect
.bottom
) / 2;
375 rect
.left
+= MulDiv(template.x
, dlgInfo
->xBaseUnit
, 4);
376 rect
.top
+= MulDiv(template.y
, dlgInfo
->yBaseUnit
, 8);
378 if ( !(template.style
& WS_CHILD
) )
382 if( !(template.style
& DS_ABSALIGN
) )
383 ClientToScreen( owner
, (POINT
*)&rect
);
385 /* try to fit it into the desktop */
387 if( (dX
= rect
.left
+ rect
.right
+ GetSystemMetrics(SM_CXDLGFRAME
)
388 - GetSystemMetrics(SM_CXSCREEN
)) > 0 ) rect
.left
-= dX
;
389 if( (dY
= rect
.top
+ rect
.bottom
+ GetSystemMetrics(SM_CYDLGFRAME
)
390 - GetSystemMetrics(SM_CYSCREEN
)) > 0 ) rect
.top
-= dY
;
391 if( rect
.left
< 0 ) rect
.left
= 0;
392 if( rect
.top
< 0 ) rect
.top
= 0;
398 ownerEnabled
= DIALOG_DisableOwner( owner
);
399 if (ownerEnabled
) dlgInfo
->flags
|= DF_OWNERENABLED
;
402 hwnd
= WIN_Handle32( CreateWindowEx16(exStyle
, template.className
,
403 template.caption
, template.style
& ~WS_VISIBLE
,
404 rect
.left
, rect
.top
, rect
.right
, rect
.bottom
,
405 HWND_16(owner
), HMENU_16(dlgInfo
->hMenu
),
409 if (dlgInfo
->hUserFont
) DeleteObject( dlgInfo
->hUserFont
);
410 if (dlgInfo
->hMenu
) DestroyMenu( dlgInfo
->hMenu
);
411 if (modal
&& (dlgInfo
->flags
& DF_OWNERENABLED
)) DIALOG_EnableOwner(owner
);
412 HeapFree( GetProcessHeap(), 0, dlgInfo
);
415 wndPtr
= WIN_GetPtr( hwnd
);
416 wndPtr
->flags
|= WIN_ISDIALOG
;
417 WIN_ReleasePtr( wndPtr
);
419 SetWindowLongPtrW( hwnd
, DWLP_WINE_DIALOGINFO
, (LONG_PTR
)dlgInfo
);
420 SetWindowLong16( HWND_16(hwnd
), DWLP_DLGPROC
, (LONG
)dlgProc
);
422 if (dlgInfo
->hUserFont
)
423 SendMessageA( hwnd
, WM_SETFONT
, (WPARAM
)dlgInfo
->hUserFont
, 0 );
425 /* Create controls */
427 if (DIALOG_CreateControls16( hwnd
, dlgTemplate
, &template, hInst
))
429 HWND hwndPreInitFocus
;
431 /* Send initialisation messages and set focus */
433 dlgInfo
->hwndFocus
= GetNextDlgTabItem( hwnd
, 0, FALSE
);
435 hwndPreInitFocus
= GetFocus();
436 if (SendMessageA( hwnd
, WM_INITDIALOG
, (WPARAM
)dlgInfo
->hwndFocus
, param
))
438 /* check where the focus is again,
439 * some controls status might have changed in WM_INITDIALOG */
440 dlgInfo
->hwndFocus
= GetNextDlgTabItem( hwnd
, 0, FALSE
);
441 if( dlgInfo
->hwndFocus
)
442 SetFocus( dlgInfo
->hwndFocus
);
446 /* If the dlgproc has returned FALSE (indicating handling of keyboard focus)
447 but the focus has not changed, set the focus where we expect it. */
448 if ((GetFocus() == hwndPreInitFocus
) &&
449 (GetWindowLongW( hwnd
, GWL_STYLE
) & WS_VISIBLE
))
451 dlgInfo
->hwndFocus
= GetNextDlgTabItem( hwnd
, 0, FALSE
);
452 if( dlgInfo
->hwndFocus
)
453 SetFocus( dlgInfo
->hwndFocus
);
457 if (template.style
& WS_VISIBLE
&& !(GetWindowLongW( hwnd
, GWL_STYLE
) & WS_VISIBLE
))
459 ShowWindow( hwnd
, SW_SHOWNORMAL
); /* SW_SHOW doesn't always work */
463 if( IsWindow(hwnd
) ) DestroyWindow( hwnd
);
464 if (modal
&& ownerEnabled
) DIALOG_EnableOwner(owner
);
469 /***********************************************************************
470 * DialogBox (USER.87)
472 INT16 WINAPI
DialogBox16( HINSTANCE16 hInst
, LPCSTR dlgTemplate
,
473 HWND16 owner
, DLGPROC16 dlgProc
)
475 return DialogBoxParam16( hInst
, dlgTemplate
, owner
, dlgProc
, 0 );
479 /**************************************************************************
480 * EndDialog (USER.88)
482 BOOL16 WINAPI
EndDialog16( HWND16 hwnd
, INT16 retval
)
484 return EndDialog( WIN_Handle32(hwnd
), retval
);
488 /***********************************************************************
489 * CreateDialog (USER.89)
491 HWND16 WINAPI
CreateDialog16( HINSTANCE16 hInst
, LPCSTR dlgTemplate
,
492 HWND16 owner
, DLGPROC16 dlgProc
)
494 return CreateDialogParam16( hInst
, dlgTemplate
, owner
, dlgProc
, 0 );
498 /**************************************************************************
499 * GetDlgItem (USER.91)
501 HWND16 WINAPI
GetDlgItem16( HWND16 hwndDlg
, INT16 id
)
503 return HWND_16( GetDlgItem( WIN_Handle32(hwndDlg
), (UINT16
) id
));
507 /**************************************************************************
508 * SetDlgItemText (USER.92)
510 void WINAPI
SetDlgItemText16( HWND16 hwnd
, INT16 id
, SEGPTR lpString
)
512 SendDlgItemMessage16( hwnd
, id
, WM_SETTEXT
, 0, (LPARAM
)lpString
);
516 /**************************************************************************
517 * GetDlgItemText (USER.93)
519 INT16 WINAPI
GetDlgItemText16( HWND16 hwnd
, INT16 id
, SEGPTR str
, UINT16 len
)
521 return (INT16
)SendDlgItemMessage16( hwnd
, id
, WM_GETTEXT
, len
, (LPARAM
)str
);
525 /**************************************************************************
526 * SetDlgItemInt (USER.94)
528 void WINAPI
SetDlgItemInt16( HWND16 hwnd
, INT16 id
, UINT16 value
, BOOL16 fSigned
)
530 SetDlgItemInt( WIN_Handle32(hwnd
), (UINT
)(UINT16
)id
,
531 (UINT
)(fSigned
? (INT16
) value
: (UINT16
) value
), fSigned
);
535 /**************************************************************************
536 * GetDlgItemInt (USER.95)
538 UINT16 WINAPI
GetDlgItemInt16( HWND16 hwnd
, INT16 id
, BOOL16
*translated
, BOOL16 fSigned
)
543 if (translated
) *translated
= FALSE
;
544 result
= GetDlgItemInt( WIN_Handle32(hwnd
), (UINT
)(UINT16
)id
, &ok
, fSigned
);
548 if (((INT
)result
< -32767) || ((INT
)result
> 32767)) return 0;
552 if (result
> 65535) return 0;
554 if (translated
) *translated
= TRUE
;
555 return (UINT16
)result
;
559 /**************************************************************************
560 * CheckRadioButton (USER.96)
562 BOOL16 WINAPI
CheckRadioButton16( HWND16 hwndDlg
, UINT16 firstID
,
563 UINT16 lastID
, UINT16 checkID
)
565 return CheckRadioButton( WIN_Handle32(hwndDlg
), firstID
, lastID
, checkID
);
569 /**************************************************************************
570 * CheckDlgButton (USER.97)
572 BOOL16 WINAPI
CheckDlgButton16( HWND16 hwnd
, INT16 id
, UINT16 check
)
574 SendDlgItemMessage16( hwnd
, id
, BM_SETCHECK16
, check
, 0 );
579 /**************************************************************************
580 * IsDlgButtonChecked (USER.98)
582 UINT16 WINAPI
IsDlgButtonChecked16( HWND16 hwnd
, UINT16 id
)
584 return (UINT16
)SendDlgItemMessage16( hwnd
, id
, BM_GETCHECK16
, 0, 0 );
588 /**************************************************************************
589 * DlgDirSelect (USER.99)
591 BOOL16 WINAPI
DlgDirSelect16( HWND16 hwnd
, LPSTR str
, INT16 id
)
593 return DlgDirSelectEx16( hwnd
, str
, 128, id
);
597 /**************************************************************************
598 * DlgDirList (USER.100)
600 INT16 WINAPI
DlgDirList16( HWND16 hDlg
, LPSTR spec
, INT16 idLBox
,
601 INT16 idStatic
, UINT16 attrib
)
603 /* according to Win16 docs, DDL_DRIVES should make DDL_EXCLUSIVE
604 * be set automatically (this is different in Win32, and
605 * DIALOG_DlgDirList sends Win32 messages to the control,
607 if (attrib
& DDL_DRIVES
) attrib
|= DDL_EXCLUSIVE
;
608 return DlgDirListA( WIN_Handle32(hDlg
), spec
, idLBox
, idStatic
, attrib
);
612 /**************************************************************************
613 * SendDlgItemMessage (USER.101)
615 LRESULT WINAPI
SendDlgItemMessage16( HWND16 hwnd
, INT16 id
, UINT16 msg
,
616 WPARAM16 wParam
, LPARAM lParam
)
618 HWND16 hwndCtrl
= GetDlgItem16( hwnd
, id
);
619 if (hwndCtrl
) return SendMessage16( hwndCtrl
, msg
, wParam
, lParam
);
624 /**************************************************************************
625 * MapDialogRect (USER.103)
627 void WINAPI
MapDialogRect16( HWND16 hwnd
, LPRECT16 rect
)
630 MapDialogRect( WIN_Handle32(hwnd
), &rect32
);
631 rect
->left
= rect32
.left
;
632 rect
->right
= rect32
.right
;
633 rect
->top
= rect32
.top
;
634 rect
->bottom
= rect32
.bottom
;
638 /**************************************************************************
639 * DlgDirSelectComboBox (USER.194)
641 BOOL16 WINAPI
DlgDirSelectComboBox16( HWND16 hwnd
, LPSTR str
, INT16 id
)
643 return DlgDirSelectComboBoxEx16( hwnd
, str
, 128, id
);
647 /**************************************************************************
648 * DlgDirListComboBox (USER.195)
650 INT16 WINAPI
DlgDirListComboBox16( HWND16 hDlg
, LPSTR spec
, INT16 idCBox
,
651 INT16 idStatic
, UINT16 attrib
)
653 return DlgDirListComboBoxA( WIN_Handle32(hDlg
), spec
, idCBox
, idStatic
, attrib
);
657 /***********************************************************************
658 * DialogBoxIndirect (USER.218)
660 INT16 WINAPI
DialogBoxIndirect16( HINSTANCE16 hInst
, HANDLE16 dlgTemplate
,
661 HWND16 owner
, DLGPROC16 dlgProc
)
663 return DialogBoxIndirectParam16( hInst
, dlgTemplate
, owner
, dlgProc
, 0 );
667 /***********************************************************************
668 * CreateDialogIndirect (USER.219)
670 HWND16 WINAPI
CreateDialogIndirect16( HINSTANCE16 hInst
, LPCVOID dlgTemplate
,
671 HWND16 owner
, DLGPROC16 dlgProc
)
673 return CreateDialogIndirectParam16( hInst
, dlgTemplate
, owner
, dlgProc
, 0);
677 /**************************************************************************
678 * GetNextDlgGroupItem (USER.227)
680 HWND16 WINAPI
GetNextDlgGroupItem16( HWND16 hwndDlg
, HWND16 hwndCtrl
,
683 return HWND_16( GetNextDlgGroupItem( WIN_Handle32(hwndDlg
), WIN_Handle32(hwndCtrl
), fPrevious
));
687 /**************************************************************************
688 * GetNextDlgTabItem (USER.228)
690 HWND16 WINAPI
GetNextDlgTabItem16( HWND16 hwndDlg
, HWND16 hwndCtrl
,
693 return HWND_16( GetNextDlgTabItem( WIN_Handle32(hwndDlg
), WIN_Handle32(hwndCtrl
), fPrevious
));
697 /***********************************************************************
698 * DialogBoxParam (USER.239)
700 INT16 WINAPI
DialogBoxParam16( HINSTANCE16 hInst
, LPCSTR
template,
701 HWND16 owner16
, DLGPROC16 dlgProc
, LPARAM param
)
709 if (!(hRsrc
= FindResource16( hInst
, template, (LPSTR
)RT_DIALOG
))) return 0;
710 if (!(hmem
= LoadResource16( hInst
, hRsrc
))) return 0;
711 if ((data
= LockResource16( hmem
)))
713 HWND owner
= WIN_Handle32(owner16
);
714 hwnd
= DIALOG_CreateIndirect16( hInst
, data
, owner
, dlgProc
, param
, TRUE
);
715 if (hwnd
) ret
= DIALOG_DoDialogBox( hwnd
, owner
);
716 GlobalUnlock16( hmem
);
718 FreeResource16( hmem
);
723 /***********************************************************************
724 * DialogBoxIndirectParam (USER.240)
726 INT16 WINAPI
DialogBoxIndirectParam16( HINSTANCE16 hInst
, HANDLE16 dlgTemplate
,
727 HWND16 owner16
, DLGPROC16 dlgProc
, LPARAM param
)
729 HWND hwnd
, owner
= WIN_Handle32( owner16
);
732 if (!(ptr
= GlobalLock16( dlgTemplate
))) return -1;
733 hwnd
= DIALOG_CreateIndirect16( hInst
, ptr
, owner
, dlgProc
, param
, TRUE
);
734 GlobalUnlock16( dlgTemplate
);
735 if (hwnd
) return DIALOG_DoDialogBox( hwnd
, owner
);
740 /***********************************************************************
741 * CreateDialogParam (USER.241)
743 HWND16 WINAPI
CreateDialogParam16( HINSTANCE16 hInst
, LPCSTR dlgTemplate
,
744 HWND16 owner
, DLGPROC16 dlgProc
, LPARAM param
)
751 TRACE("%04x,%s,%04x,%08lx,%ld\n",
752 hInst
, debugstr_a(dlgTemplate
), owner
, (DWORD
)dlgProc
, param
);
754 if (!(hRsrc
= FindResource16( hInst
, dlgTemplate
, (LPSTR
)RT_DIALOG
))) return 0;
755 if (!(hmem
= LoadResource16( hInst
, hRsrc
))) return 0;
756 if (!(data
= LockResource16( hmem
))) hwnd
= 0;
757 else hwnd
= CreateDialogIndirectParam16( hInst
, data
, owner
, dlgProc
, param
);
758 FreeResource16( hmem
);
763 /***********************************************************************
764 * CreateDialogIndirectParam (USER.242)
766 HWND16 WINAPI
CreateDialogIndirectParam16( HINSTANCE16 hInst
, LPCVOID dlgTemplate
,
767 HWND16 owner
, DLGPROC16 dlgProc
, LPARAM param
)
769 if (!dlgTemplate
) return 0;
770 return HWND_16( DIALOG_CreateIndirect16( hInst
, dlgTemplate
, WIN_Handle32(owner
),
771 dlgProc
, param
, FALSE
));
775 /**************************************************************************
776 * DlgDirSelectEx (USER.422)
778 BOOL16 WINAPI
DlgDirSelectEx16( HWND16 hwnd
, LPSTR str
, INT16 len
, INT16 id
)
780 return DlgDirSelectExA( WIN_Handle32(hwnd
), str
, len
, id
);
784 /**************************************************************************
785 * DlgDirSelectComboBoxEx (USER.423)
787 BOOL16 WINAPI
DlgDirSelectComboBoxEx16( HWND16 hwnd
, LPSTR str
, INT16 len
,
790 return DlgDirSelectComboBoxExA( WIN_Handle32(hwnd
), str
, len
, id
);