user32: Don't overwrite the default button id when creating the dialog structure.
[wine/multimedia.git] / dlls / user.exe16 / dialog.c
blobab6cb38755a10386ecd06321f90bea8d82b3f054
1 /*
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
21 #include "config.h"
22 #include "wine/port.h"
24 #include <stdarg.h>
26 #include "windef.h"
27 #include "winbase.h"
28 #include "wownt32.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 */
36 typedef struct
38 DWORD style;
39 INT16 x;
40 INT16 y;
41 INT16 cx;
42 INT16 cy;
43 UINT id;
44 LPCSTR className;
45 LPCSTR windowName;
46 LPCVOID data;
47 } DLG_CONTROL_INFO;
49 /* Dialog template */
50 typedef struct
52 DWORD style;
53 UINT16 nbItems;
54 INT16 x;
55 INT16 y;
56 INT16 cx;
57 INT16 cy;
58 LPCSTR menuName;
59 LPCSTR className;
60 LPCSTR caption;
61 INT16 pointSize;
62 LPCSTR faceName;
63 } DLG_TEMPLATE;
65 #define DIALOG_CLASS_ATOM MAKEINTATOM(32770)
67 /***********************************************************************
68 * DIALOG_EnableOwner
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 */
76 if (hOwner)
77 hOwner = GetAncestor( hOwner, GA_ROOT );
78 if (!hOwner) return;
79 EnableWindow( hOwner, TRUE );
83 /***********************************************************************
84 * DIALOG_DisableOwner
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 */
92 if (hOwner)
93 hOwner = GetAncestor( hOwner, GA_ROOT );
94 if (!hOwner) return FALSE;
95 if (IsWindowEnabled( hOwner ))
97 EnableWindow( hOwner, FALSE );
98 return TRUE;
100 else
101 return 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];
114 int int_id;
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);
123 if (*p & 0x80)
125 switch((BYTE)*p)
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;
136 p++;
138 else
140 info->className = p;
141 p += strlen(p) + 1;
144 int_id = ((BYTE)*p == 0xff);
145 if (int_id)
147 /* Integer id, not documented (?). Only works for SS_ICON controls */
148 info->windowName = MAKEINTRESOURCEA(GET_WORD(p+1));
149 p += 3;
151 else
153 info->windowName = p;
154 p += strlen(p) + 1;
157 if (*p) info->data = p + 1;
158 else info->data = NULL;
160 p += *p + 1;
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 );
167 return p;
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;
184 TRACE(" BEGIN\n" );
185 while (items--)
187 HINSTANCE16 instance = hInst;
188 SEGPTR segptr;
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 ));
201 UnMapLS( segptr );
203 if (!hwndCtrl)
205 if (dlgTemplate->style & DS_NOFAILCREATE) continue;
206 return FALSE;
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. */
216 if (hwndDefButton)
217 SendMessageA( hwndDefButton, BM_SETSTYLE,
218 BS_PUSHBUTTON,FALSE );
219 hwndDefButton = hwndCtrl;
220 dlgInfo->idResult = GetWindowLongPtrA( hwndCtrl, GWLP_ID );
223 TRACE(" END\n" );
224 return TRUE;
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 */
248 switch( (BYTE)*p )
250 case 0:
251 result->menuName = 0;
252 p++;
253 break;
254 case 0xff:
255 result->menuName = MAKEINTRESOURCEA(GET_WORD( p + 1 ));
256 p += 3;
257 TRACE(" MENU %04x\n", LOWORD(result->menuName) );
258 break;
259 default:
260 result->menuName = p;
261 TRACE(" MENU '%s'\n", p );
262 p += strlen(p) + 1;
263 break;
266 /* Get the class name */
268 if (*p)
270 result->className = p;
271 TRACE(" CLASS '%s'\n", result->className );
273 else result->className = (LPCSTR)DIALOG_CLASS_ATOM;
274 p += strlen(p) + 1;
276 /* Get the window caption */
278 result->caption = p;
279 p += strlen(p) + 1;
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);
290 p += sizeof(WORD);
291 result->faceName = p;
292 p += strlen(p) + 1;
293 TRACE(" FONT %d,'%s'\n", result->pointSize, result->faceName );
295 return p;
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,
310 BOOL modal )
312 HWND hwnd;
313 RECT rect;
314 POINT pos;
315 SIZE size;
316 DLG_TEMPLATE template;
317 DIALOGINFO * dlgInfo;
318 BOOL ownerEnabled = TRUE;
319 DWORD exStyle = 0;
320 DWORD units = GetDialogBaseUnits();
321 HMENU16 hMenu = 0;
322 HFONT hUserFont = 0;
323 UINT flags = 0;
324 UINT xBaseUnit = LOWORD(units);
325 UINT yBaseUnit = HIWORD(units);
327 /* Parse dialog template */
329 dlgTemplate = DIALOG_ParseTemplate16( dlgTemplate, &template );
331 /* Load menu */
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 */
341 HDC dc;
342 int pixels;
343 dc = GetDC(0);
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 );
348 if (hUserFont)
350 SIZE charSize;
351 HFONT hOldFont = SelectObject( dc, hUserFont );
352 charSize.cx = GdiGetCharDimensions( dc, NULL, &charSize.cy );
353 if (charSize.cx)
355 xBaseUnit = charSize.cx;
356 yBaseUnit = charSize.cy;
358 SelectObject( dc, hOldFont );
360 ReleaseDC(0, dc);
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 );
371 pos.x = rect.left;
372 pos.y = rect.top;
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;
380 else
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 );
399 else
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) )
407 INT dX, dY;
409 /* try to fit it into the desktop */
411 if (!monitor)
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)
418 pos.x -= dX;
419 if ((dY = pos.y + size.cy + GetSystemMetrics(SM_CYDLGFRAME) - mon_info.rcWork.bottom) > 0)
420 pos.y -= dY;
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;
426 if (modal)
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 ));
436 if (!hwnd)
438 if (hUserFont) DeleteObject( hUserFont );
439 if (hMenu) DestroyMenu16( hMenu );
440 if (modal && (flags & DF_OWNERENABLED)) DIALOG_EnableOwner(owner);
441 return 0;
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->flags = flags;
451 SetWindowLong16( HWND_16(hwnd), DWLP_DLGPROC, (LONG)dlgProc );
453 if (hUserFont)
454 SendMessageA( hwnd, WM_SETFONT, (WPARAM)hUserFont, 0 );
456 /* Create controls */
458 if (DIALOG_CreateControls16( hwnd, dlgTemplate, &template, hInst ))
460 HWND hwndPreInitFocus;
462 /* Send initialisation messages and set focus */
464 dlgInfo->hwndFocus = GetNextDlgTabItem( hwnd, 0, FALSE );
466 hwndPreInitFocus = GetFocus();
467 if (SendMessageA( hwnd, WM_INITDIALOG, (WPARAM)dlgInfo->hwndFocus, param ))
469 /* check where the focus is again,
470 * some controls status might have changed in WM_INITDIALOG */
471 dlgInfo->hwndFocus = GetNextDlgTabItem( hwnd, 0, FALSE);
472 if( dlgInfo->hwndFocus )
473 SetFocus( dlgInfo->hwndFocus );
475 else
477 /* If the dlgproc has returned FALSE (indicating handling of keyboard focus)
478 but the focus has not changed, set the focus where we expect it. */
479 if ((GetFocus() == hwndPreInitFocus) &&
480 (GetWindowLongW( hwnd, GWL_STYLE ) & WS_VISIBLE))
482 dlgInfo->hwndFocus = GetNextDlgTabItem( hwnd, 0, FALSE);
483 if( dlgInfo->hwndFocus )
484 SetFocus( dlgInfo->hwndFocus );
488 if (template.style & WS_VISIBLE && !(GetWindowLongW( hwnd, GWL_STYLE ) & WS_VISIBLE))
490 ShowWindow( hwnd, SW_SHOWNORMAL ); /* SW_SHOW doesn't always work */
492 return hwnd;
494 if( IsWindow(hwnd) ) DestroyWindow( hwnd );
495 if (modal && ownerEnabled) DIALOG_EnableOwner(owner);
496 return 0;
500 /***********************************************************************
501 * DialogBox (USER.87)
503 INT16 WINAPI DialogBox16( HINSTANCE16 hInst, LPCSTR dlgTemplate,
504 HWND16 owner, DLGPROC16 dlgProc )
506 return DialogBoxParam16( hInst, dlgTemplate, owner, dlgProc, 0 );
510 /**************************************************************************
511 * EndDialog (USER.88)
513 BOOL16 WINAPI EndDialog16( HWND16 hwnd, INT16 retval )
515 return EndDialog( WIN_Handle32(hwnd), retval );
519 /***********************************************************************
520 * CreateDialog (USER.89)
522 HWND16 WINAPI CreateDialog16( HINSTANCE16 hInst, LPCSTR dlgTemplate,
523 HWND16 owner, DLGPROC16 dlgProc )
525 return CreateDialogParam16( hInst, dlgTemplate, owner, dlgProc, 0 );
529 /**************************************************************************
530 * GetDlgItem (USER.91)
532 HWND16 WINAPI GetDlgItem16( HWND16 hwndDlg, INT16 id )
534 return HWND_16( GetDlgItem( WIN_Handle32(hwndDlg), (UINT16) id ));
538 /**************************************************************************
539 * SetDlgItemText (USER.92)
541 void WINAPI SetDlgItemText16( HWND16 hwnd, INT16 id, SEGPTR lpString )
543 SendDlgItemMessage16( hwnd, id, WM_SETTEXT, 0, lpString );
547 /**************************************************************************
548 * GetDlgItemText (USER.93)
550 INT16 WINAPI GetDlgItemText16( HWND16 hwnd, INT16 id, SEGPTR str, UINT16 len )
552 return SendDlgItemMessage16( hwnd, id, WM_GETTEXT, len, str );
556 /**************************************************************************
557 * SetDlgItemInt (USER.94)
559 void WINAPI SetDlgItemInt16( HWND16 hwnd, INT16 id, UINT16 value, BOOL16 fSigned )
561 SetDlgItemInt( WIN_Handle32(hwnd), (UINT)(UINT16)id,
562 (UINT)(fSigned ? (INT16) value : value), fSigned );
566 /**************************************************************************
567 * GetDlgItemInt (USER.95)
569 UINT16 WINAPI GetDlgItemInt16( HWND16 hwnd, INT16 id, BOOL16 *translated, BOOL16 fSigned )
571 UINT result;
572 BOOL ok;
574 if (translated) *translated = FALSE;
575 result = GetDlgItemInt( WIN_Handle32(hwnd), (UINT)(UINT16)id, &ok, fSigned );
576 if (!ok) return 0;
577 if (fSigned)
579 if (((INT)result < -32767) || ((INT)result > 32767)) return 0;
581 else
583 if (result > 65535) return 0;
585 if (translated) *translated = TRUE;
586 return (UINT16)result;
590 /**************************************************************************
591 * CheckRadioButton (USER.96)
593 BOOL16 WINAPI CheckRadioButton16( HWND16 hwndDlg, UINT16 firstID,
594 UINT16 lastID, UINT16 checkID )
596 return CheckRadioButton( WIN_Handle32(hwndDlg), firstID, lastID, checkID );
600 /**************************************************************************
601 * CheckDlgButton (USER.97)
603 BOOL16 WINAPI CheckDlgButton16( HWND16 hwnd, INT16 id, UINT16 check )
605 SendDlgItemMessage16( hwnd, id, BM_SETCHECK16, check, 0 );
606 return TRUE;
610 /**************************************************************************
611 * IsDlgButtonChecked (USER.98)
613 UINT16 WINAPI IsDlgButtonChecked16( HWND16 hwnd, UINT16 id )
615 return (UINT16)SendDlgItemMessage16( hwnd, id, BM_GETCHECK16, 0, 0 );
619 /**************************************************************************
620 * DlgDirSelect (USER.99)
622 BOOL16 WINAPI DlgDirSelect16( HWND16 hwnd, LPSTR str, INT16 id )
624 return DlgDirSelectEx16( hwnd, str, 128, id );
628 /**************************************************************************
629 * DlgDirList (USER.100)
631 INT16 WINAPI DlgDirList16( HWND16 hDlg, LPSTR spec, INT16 idLBox,
632 INT16 idStatic, UINT16 attrib )
634 /* according to Win16 docs, DDL_DRIVES should make DDL_EXCLUSIVE
635 * be set automatically (this is different in Win32, and
636 * DIALOG_DlgDirList sends Win32 messages to the control,
637 * so do it here) */
638 if (attrib & DDL_DRIVES) attrib |= DDL_EXCLUSIVE;
639 return DlgDirListA( WIN_Handle32(hDlg), spec, idLBox, idStatic, attrib );
643 /**************************************************************************
644 * SendDlgItemMessage (USER.101)
646 LRESULT WINAPI SendDlgItemMessage16( HWND16 hwnd, INT16 id, UINT16 msg,
647 WPARAM16 wParam, LPARAM lParam )
649 HWND16 hwndCtrl = GetDlgItem16( hwnd, id );
650 if (hwndCtrl) return SendMessage16( hwndCtrl, msg, wParam, lParam );
651 else return 0;
655 /**************************************************************************
656 * MapDialogRect (USER.103)
658 void WINAPI MapDialogRect16( HWND16 hwnd, LPRECT16 rect )
660 RECT rect32;
661 MapDialogRect( WIN_Handle32(hwnd), &rect32 );
662 rect->left = rect32.left;
663 rect->right = rect32.right;
664 rect->top = rect32.top;
665 rect->bottom = rect32.bottom;
669 /**************************************************************************
670 * DlgDirSelectComboBox (USER.194)
672 BOOL16 WINAPI DlgDirSelectComboBox16( HWND16 hwnd, LPSTR str, INT16 id )
674 return DlgDirSelectComboBoxEx16( hwnd, str, 128, id );
678 /**************************************************************************
679 * DlgDirListComboBox (USER.195)
681 INT16 WINAPI DlgDirListComboBox16( HWND16 hDlg, LPSTR spec, INT16 idCBox,
682 INT16 idStatic, UINT16 attrib )
684 return DlgDirListComboBoxA( WIN_Handle32(hDlg), spec, idCBox, idStatic, attrib );
688 /***********************************************************************
689 * DialogBoxIndirect (USER.218)
691 INT16 WINAPI DialogBoxIndirect16( HINSTANCE16 hInst, HANDLE16 dlgTemplate,
692 HWND16 owner, DLGPROC16 dlgProc )
694 return DialogBoxIndirectParam16( hInst, dlgTemplate, owner, dlgProc, 0 );
698 /***********************************************************************
699 * CreateDialogIndirect (USER.219)
701 HWND16 WINAPI CreateDialogIndirect16( HINSTANCE16 hInst, LPCVOID dlgTemplate,
702 HWND16 owner, DLGPROC16 dlgProc )
704 return CreateDialogIndirectParam16( hInst, dlgTemplate, owner, dlgProc, 0);
708 /**************************************************************************
709 * GetNextDlgGroupItem (USER.227)
711 HWND16 WINAPI GetNextDlgGroupItem16( HWND16 hwndDlg, HWND16 hwndCtrl,
712 BOOL16 fPrevious )
714 return HWND_16( GetNextDlgGroupItem( WIN_Handle32(hwndDlg), WIN_Handle32(hwndCtrl), fPrevious ));
718 /**************************************************************************
719 * GetNextDlgTabItem (USER.228)
721 HWND16 WINAPI GetNextDlgTabItem16( HWND16 hwndDlg, HWND16 hwndCtrl,
722 BOOL16 fPrevious )
724 return HWND_16( GetNextDlgTabItem( WIN_Handle32(hwndDlg), WIN_Handle32(hwndCtrl), fPrevious ));
728 /***********************************************************************
729 * DialogBoxParam (USER.239)
731 INT16 WINAPI DialogBoxParam16( HINSTANCE16 hInst, LPCSTR template,
732 HWND16 owner16, DLGPROC16 dlgProc, LPARAM param )
734 HWND hwnd = 0;
735 HRSRC16 hRsrc;
736 HGLOBAL16 hmem;
737 LPCVOID data;
738 int ret = -1;
740 if (!(hRsrc = FindResource16( hInst, template, (LPSTR)RT_DIALOG ))) return 0;
741 if (!(hmem = LoadResource16( hInst, hRsrc ))) return 0;
742 if ((data = LockResource16( hmem )))
744 HWND owner = WIN_Handle32(owner16);
745 hwnd = DIALOG_CreateIndirect16( hInst, data, owner, dlgProc, param, TRUE );
746 if (hwnd) ret = wow_handlers32.dialog_box_loop( hwnd, owner );
747 GlobalUnlock16( hmem );
749 FreeResource16( hmem );
750 return ret;
754 /***********************************************************************
755 * DialogBoxIndirectParam (USER.240)
757 INT16 WINAPI DialogBoxIndirectParam16( HINSTANCE16 hInst, HANDLE16 dlgTemplate,
758 HWND16 owner16, DLGPROC16 dlgProc, LPARAM param )
760 HWND hwnd, owner = WIN_Handle32( owner16 );
761 LPCVOID ptr;
763 if (!(ptr = GlobalLock16( dlgTemplate ))) return -1;
764 hwnd = DIALOG_CreateIndirect16( hInst, ptr, owner, dlgProc, param, TRUE );
765 GlobalUnlock16( dlgTemplate );
766 if (hwnd) return wow_handlers32.dialog_box_loop( hwnd, owner );
767 return -1;
771 /***********************************************************************
772 * CreateDialogParam (USER.241)
774 HWND16 WINAPI CreateDialogParam16( HINSTANCE16 hInst, LPCSTR dlgTemplate,
775 HWND16 owner, DLGPROC16 dlgProc, LPARAM param )
777 HWND16 hwnd = 0;
778 HRSRC16 hRsrc;
779 HGLOBAL16 hmem;
780 LPCVOID data;
782 TRACE("%04x,%s,%04x,%p,%ld\n",
783 hInst, debugstr_a(dlgTemplate), owner, dlgProc, param );
785 if (!(hRsrc = FindResource16( hInst, dlgTemplate, (LPSTR)RT_DIALOG ))) return 0;
786 if (!(hmem = LoadResource16( hInst, hRsrc ))) return 0;
787 if (!(data = LockResource16( hmem ))) hwnd = 0;
788 else hwnd = CreateDialogIndirectParam16( hInst, data, owner, dlgProc, param );
789 FreeResource16( hmem );
790 return hwnd;
794 /***********************************************************************
795 * CreateDialogIndirectParam (USER.242)
797 HWND16 WINAPI CreateDialogIndirectParam16( HINSTANCE16 hInst, LPCVOID dlgTemplate,
798 HWND16 owner, DLGPROC16 dlgProc, LPARAM param )
800 if (!dlgTemplate) return 0;
801 return HWND_16( DIALOG_CreateIndirect16( hInst, dlgTemplate, WIN_Handle32(owner),
802 dlgProc, param, FALSE ));
806 /**************************************************************************
807 * DlgDirSelectEx (USER.422)
809 BOOL16 WINAPI DlgDirSelectEx16( HWND16 hwnd, LPSTR str, INT16 len, INT16 id )
811 return DlgDirSelectExA( WIN_Handle32(hwnd), str, len, id );
815 /**************************************************************************
816 * DlgDirSelectComboBoxEx (USER.423)
818 BOOL16 WINAPI DlgDirSelectComboBoxEx16( HWND16 hwnd, LPSTR str, INT16 len,
819 INT16 id )
821 return DlgDirSelectComboBoxExA( WIN_Handle32(hwnd), str, len, id );