xinput1_3: Move HID data into struct xinput_controller.
[wine.git] / dlls / user.exe16 / dialog.c
blob104163845628fa5c8539a9999d34b20510d9e6d6
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 <stdarg.h>
23 #include "windef.h"
24 #include "winbase.h"
25 #include "wownt32.h"
26 #include "wine/winuser16.h"
27 #include "user_private.h"
28 #include "wine/debug.h"
30 WINE_DEFAULT_DEBUG_CHANNEL(dialog);
32 /* Dialog control information */
33 typedef struct
35 DWORD style;
36 INT16 x;
37 INT16 y;
38 INT16 cx;
39 INT16 cy;
40 UINT id;
41 LPCSTR className;
42 LPCSTR windowName;
43 LPCVOID data;
44 } DLG_CONTROL_INFO;
46 /* Dialog template */
47 typedef struct
49 DWORD style;
50 UINT16 nbItems;
51 INT16 x;
52 INT16 y;
53 INT16 cx;
54 INT16 cy;
55 LPCSTR menuName;
56 LPCSTR className;
57 LPCSTR caption;
58 INT16 pointSize;
59 LPCSTR faceName;
60 } DLG_TEMPLATE;
62 #define DIALOG_CLASS_ATOM MAKEINTATOM(32770)
64 /***********************************************************************
65 * DIALOG_EnableOwner
67 * Helper function for modal dialogs to enable again the
68 * owner of the dialog box.
70 static void DIALOG_EnableOwner( HWND hOwner )
72 /* Owner must be a top-level window */
73 if (hOwner)
74 hOwner = GetAncestor( hOwner, GA_ROOT );
75 if (!hOwner) return;
76 EnableWindow( hOwner, TRUE );
80 /***********************************************************************
81 * DIALOG_DisableOwner
83 * Helper function for modal dialogs to disable the
84 * owner of the dialog box. Returns TRUE if owner was enabled.
86 static BOOL DIALOG_DisableOwner( HWND hOwner )
88 /* Owner must be a top-level window */
89 if (hOwner)
90 hOwner = GetAncestor( hOwner, GA_ROOT );
91 if (!hOwner) return FALSE;
92 if (IsWindowEnabled( hOwner ))
94 EnableWindow( hOwner, FALSE );
95 return TRUE;
97 else
98 return FALSE;
102 /***********************************************************************
103 * DIALOG_GetControl16
105 * Return the class and text of the control pointed to by ptr,
106 * fill the header structure and return a pointer to the next control.
108 static LPCSTR DIALOG_GetControl16( LPCSTR p, DLG_CONTROL_INFO *info )
110 static char buffer[10];
111 int int_id;
113 info->x = GET_WORD(p); p += sizeof(WORD);
114 info->y = GET_WORD(p); p += sizeof(WORD);
115 info->cx = GET_WORD(p); p += sizeof(WORD);
116 info->cy = GET_WORD(p); p += sizeof(WORD);
117 info->id = GET_WORD(p); p += sizeof(WORD);
118 info->style = GET_DWORD(p); p += sizeof(DWORD);
120 if (*p & 0x80)
122 switch((BYTE)*p)
124 case 0x80: strcpy( buffer, "BUTTON" ); break;
125 case 0x81: strcpy( buffer, "EDIT" ); break;
126 case 0x82: strcpy( buffer, "STATIC" ); break;
127 case 0x83: strcpy( buffer, "LISTBOX" ); break;
128 case 0x84: strcpy( buffer, "SCROLLBAR" ); break;
129 case 0x85: strcpy( buffer, "COMBOBOX" ); break;
130 default: buffer[0] = '\0'; break;
132 info->className = buffer;
133 p++;
135 else
137 info->className = p;
138 p += strlen(p) + 1;
141 int_id = ((BYTE)*p == 0xff);
142 if (int_id)
144 /* Integer id, not documented (?). Only works for SS_ICON controls */
145 info->windowName = MAKEINTRESOURCEA(GET_WORD(p+1));
146 p += 3;
148 else
150 info->windowName = p;
151 p += strlen(p) + 1;
154 if (*p) info->data = p + 1;
155 else info->data = NULL;
157 p += *p + 1;
159 TRACE(" %s %s %d, %d, %d, %d, %d, %08x, %p\n",
160 debugstr_a(info->className), debugstr_a(info->windowName),
161 info->id, info->x, info->y, info->cx, info->cy,
162 info->style, info->data );
164 return p;
168 /***********************************************************************
169 * DIALOG_CreateControls16
171 * Create the control windows for a dialog.
173 static BOOL DIALOG_CreateControls16( HWND hwnd, LPCSTR template,
174 const DLG_TEMPLATE *dlgTemplate, HINSTANCE16 hInst )
176 DIALOGINFO *dlgInfo = wow_handlers32.get_dialog_info( hwnd, TRUE );
177 DLG_CONTROL_INFO info;
178 HWND hwndCtrl, hwndDefButton = 0;
179 INT items = dlgTemplate->nbItems;
181 TRACE(" BEGIN\n" );
182 while (items--)
184 HINSTANCE16 instance = hInst;
185 SEGPTR segptr;
187 template = DIALOG_GetControl16( template, &info );
188 segptr = MapLS( info.data );
189 hwndCtrl = WIN_Handle32( CreateWindowEx16( WS_EX_NOPARENTNOTIFY,
190 info.className, info.windowName,
191 info.style | WS_CHILD,
192 MulDiv(info.x, dlgInfo->xBaseUnit, 4),
193 MulDiv(info.y, dlgInfo->yBaseUnit, 8),
194 MulDiv(info.cx, dlgInfo->xBaseUnit, 4),
195 MulDiv(info.cy, dlgInfo->yBaseUnit, 8),
196 HWND_16(hwnd), (HMENU16)info.id,
197 instance, (LPVOID)segptr ));
198 UnMapLS( segptr );
200 if (!hwndCtrl)
202 if (dlgTemplate->style & DS_NOFAILCREATE) continue;
203 return FALSE;
206 /* Send initialisation messages to the control */
207 if (dlgInfo->hUserFont) SendMessageA( hwndCtrl, WM_SETFONT,
208 (WPARAM)dlgInfo->hUserFont, 0 );
209 if (SendMessageA(hwndCtrl, WM_GETDLGCODE, 0, 0) & DLGC_DEFPUSHBUTTON)
211 /* If there's already a default push-button, set it back */
212 /* to normal and use this one instead. */
213 if (hwndDefButton)
214 SendMessageA( hwndDefButton, BM_SETSTYLE,
215 BS_PUSHBUTTON,FALSE );
216 hwndDefButton = hwndCtrl;
217 dlgInfo->idResult = GetWindowLongPtrA( hwndCtrl, GWLP_ID );
220 TRACE(" END\n" );
221 return TRUE;
225 /***********************************************************************
226 * DIALOG_ParseTemplate16
228 * Fill a DLG_TEMPLATE structure from the dialog template, and return
229 * a pointer to the first control.
231 static LPCSTR DIALOG_ParseTemplate16( LPCSTR p, DLG_TEMPLATE * result )
233 result->style = GET_DWORD(p); p += sizeof(DWORD);
234 result->nbItems = (unsigned char) *p++;
235 result->x = GET_WORD(p); p += sizeof(WORD);
236 result->y = GET_WORD(p); p += sizeof(WORD);
237 result->cx = GET_WORD(p); p += sizeof(WORD);
238 result->cy = GET_WORD(p); p += sizeof(WORD);
240 TRACE("DIALOG %d, %d, %d, %d\n", result->x, result->y, result->cx, result->cy );
241 TRACE(" STYLE %08x\n", result->style );
243 /* Get the menu name */
245 switch( (BYTE)*p )
247 case 0:
248 result->menuName = 0;
249 p++;
250 break;
251 case 0xff:
252 result->menuName = MAKEINTRESOURCEA(GET_WORD( p + 1 ));
253 p += 3;
254 TRACE(" MENU %04x\n", LOWORD(result->menuName) );
255 break;
256 default:
257 result->menuName = p;
258 TRACE(" MENU '%s'\n", p );
259 p += strlen(p) + 1;
260 break;
263 /* Get the class name */
265 if (*p)
267 result->className = p;
268 TRACE(" CLASS '%s'\n", result->className );
270 else result->className = (LPCSTR)DIALOG_CLASS_ATOM;
271 p += strlen(p) + 1;
273 /* Get the window caption */
275 result->caption = p;
276 p += strlen(p) + 1;
277 TRACE(" CAPTION '%s'\n", result->caption );
279 /* Get the font name */
281 result->pointSize = 0;
282 result->faceName = NULL;
284 if (result->style & DS_SETFONT)
286 result->pointSize = GET_WORD(p);
287 p += sizeof(WORD);
288 result->faceName = p;
289 p += strlen(p) + 1;
290 TRACE(" FONT %d,'%s'\n", result->pointSize, result->faceName );
292 return p;
296 /***********************************************************************
297 * DIALOG_CreateIndirect16
299 * Creates a dialog box window
301 * modal = TRUE if we are called from a modal dialog box.
302 * (it's more compatible to do it here, as under Windows the owner
303 * is never disabled if the dialog fails because of an invalid template)
305 static HWND DIALOG_CreateIndirect16( HINSTANCE16 hInst, LPCVOID dlgTemplate,
306 HWND owner, DLGPROC16 dlgProc, LPARAM param,
307 BOOL modal )
309 HWND hwnd;
310 RECT rect;
311 POINT pos;
312 SIZE size;
313 DLG_TEMPLATE template;
314 DIALOGINFO * dlgInfo;
315 BOOL ownerEnabled = TRUE;
316 DWORD exStyle = 0;
317 DWORD units = GetDialogBaseUnits();
318 HMENU16 hMenu = 0;
319 HFONT hUserFont = 0;
320 UINT flags = 0;
321 UINT xBaseUnit = LOWORD(units);
322 UINT yBaseUnit = HIWORD(units);
324 /* Parse dialog template */
326 dlgTemplate = DIALOG_ParseTemplate16( dlgTemplate, &template );
328 /* Load menu */
330 if (template.menuName) hMenu = LoadMenu16( hInst, template.menuName );
332 /* Create custom font if needed */
334 if (template.style & DS_SETFONT)
336 /* We convert the size to pixels and then make it -ve. This works
337 * for both +ve and -ve template.pointSize */
338 HDC dc;
339 int pixels;
340 dc = GetDC(0);
341 pixels = MulDiv(template.pointSize, GetDeviceCaps(dc , LOGPIXELSY), 72);
342 hUserFont = CreateFontA( -pixels, 0, 0, 0, FW_DONTCARE,
343 FALSE, FALSE, FALSE, DEFAULT_CHARSET, 0, 0,
344 PROOF_QUALITY, FF_DONTCARE, template.faceName );
345 if (hUserFont)
347 SIZE charSize;
348 HFONT hOldFont = SelectObject( dc, hUserFont );
349 charSize.cx = GdiGetCharDimensions( dc, NULL, &charSize.cy );
350 if (charSize.cx)
352 xBaseUnit = charSize.cx;
353 yBaseUnit = charSize.cy;
355 SelectObject( dc, hOldFont );
357 ReleaseDC(0, dc);
358 TRACE("units = %d,%d\n", xBaseUnit, yBaseUnit );
361 /* Create dialog main window */
363 rect.left = rect.top = 0;
364 rect.right = MulDiv(template.cx, xBaseUnit, 4);
365 rect.bottom = MulDiv(template.cy, yBaseUnit, 8);
366 if (template.style & DS_MODALFRAME) exStyle |= WS_EX_DLGMODALFRAME;
367 AdjustWindowRectEx( &rect, template.style, (hMenu != 0), exStyle );
368 pos.x = rect.left;
369 pos.y = rect.top;
370 size.cx = rect.right - rect.left;
371 size.cy = rect.bottom - rect.top;
373 if (template.x == CW_USEDEFAULT16)
375 pos.x = pos.y = CW_USEDEFAULT16;
377 else
379 HMONITOR monitor = 0;
380 MONITORINFO mon_info;
382 mon_info.cbSize = sizeof(mon_info);
383 if (template.style & DS_CENTER)
385 monitor = MonitorFromWindow( owner ? owner : GetActiveWindow(), MONITOR_DEFAULTTOPRIMARY );
386 GetMonitorInfoW( monitor, &mon_info );
387 pos.x = (mon_info.rcWork.left + mon_info.rcWork.right - size.cx) / 2;
388 pos.y = (mon_info.rcWork.top + mon_info.rcWork.bottom - size.cy) / 2;
390 else if (template.style & DS_CENTERMOUSE)
392 GetCursorPos( &pos );
393 monitor = MonitorFromPoint( pos, MONITOR_DEFAULTTOPRIMARY );
394 GetMonitorInfoW( monitor, &mon_info );
396 else
398 pos.x += MulDiv(template.x, xBaseUnit, 4);
399 pos.y += MulDiv(template.y, yBaseUnit, 8);
400 if (!(template.style & (WS_CHILD|DS_ABSALIGN))) ClientToScreen( owner, &pos );
402 if ( !(template.style & WS_CHILD) )
404 INT dX, dY;
406 /* try to fit it into the desktop */
408 if (!monitor)
410 SetRect( &rect, pos.x, pos.y, pos.x + size.cx, pos.y + size.cy );
411 monitor = MonitorFromRect( &rect, MONITOR_DEFAULTTOPRIMARY );
412 GetMonitorInfoW( monitor, &mon_info );
414 if ((dX = pos.x + size.cx + GetSystemMetrics(SM_CXDLGFRAME) - mon_info.rcWork.right) > 0)
415 pos.x -= dX;
416 if ((dY = pos.y + size.cy + GetSystemMetrics(SM_CYDLGFRAME) - mon_info.rcWork.bottom) > 0)
417 pos.y -= dY;
418 if( pos.x < mon_info.rcWork.left ) pos.x = mon_info.rcWork.left;
419 if( pos.y < mon_info.rcWork.top ) pos.y = mon_info.rcWork.top;
423 if (modal)
425 ownerEnabled = DIALOG_DisableOwner( owner );
426 if (ownerEnabled) flags |= DF_OWNERENABLED;
429 hwnd = WIN_Handle32( CreateWindowEx16(exStyle, template.className,
430 template.caption, template.style & ~WS_VISIBLE,
431 pos.x, pos.y, size.cx, size.cy,
432 HWND_16(owner), hMenu, hInst, NULL ));
433 if (!hwnd)
435 if (hUserFont) DeleteObject( hUserFont );
436 if (hMenu) DestroyMenu16( hMenu );
437 if (modal && (flags & DF_OWNERENABLED)) DIALOG_EnableOwner(owner);
438 return 0;
440 dlgInfo = wow_handlers32.get_dialog_info( hwnd, TRUE );
441 dlgInfo->hwndFocus = 0;
442 dlgInfo->hUserFont = hUserFont;
443 dlgInfo->hMenu = HMENU_32( hMenu );
444 dlgInfo->xBaseUnit = xBaseUnit;
445 dlgInfo->yBaseUnit = yBaseUnit;
446 dlgInfo->idResult = 0;
447 dlgInfo->flags = flags;
449 SetWindowLong16( HWND_16(hwnd), DWLP_DLGPROC, (LONG)dlgProc );
451 if (hUserFont)
452 SendMessageA( hwnd, WM_SETFONT, (WPARAM)hUserFont, 0 );
454 /* Create controls */
456 if (DIALOG_CreateControls16( hwnd, dlgTemplate, &template, hInst ))
458 HWND hwndPreInitFocus;
460 /* Send initialisation messages and set focus */
462 dlgInfo->hwndFocus = GetNextDlgTabItem( hwnd, 0, FALSE );
464 hwndPreInitFocus = GetFocus();
465 if (SendMessageA( hwnd, WM_INITDIALOG, (WPARAM)dlgInfo->hwndFocus, param ))
467 /* check where the focus is again,
468 * some controls status might have changed in WM_INITDIALOG */
469 dlgInfo->hwndFocus = GetNextDlgTabItem( hwnd, 0, FALSE);
470 if( dlgInfo->hwndFocus )
471 SetFocus( dlgInfo->hwndFocus );
473 else
475 /* If the dlgproc has returned FALSE (indicating handling of keyboard focus)
476 but the focus has not changed, set the focus where we expect it. */
477 if ((GetFocus() == hwndPreInitFocus) &&
478 (GetWindowLongW( hwnd, GWL_STYLE ) & WS_VISIBLE))
480 dlgInfo->hwndFocus = GetNextDlgTabItem( hwnd, 0, FALSE);
481 if( dlgInfo->hwndFocus )
482 SetFocus( dlgInfo->hwndFocus );
486 if (template.style & WS_VISIBLE && !(GetWindowLongW( hwnd, GWL_STYLE ) & WS_VISIBLE))
488 ShowWindow( hwnd, SW_SHOWNORMAL ); /* SW_SHOW doesn't always work */
490 return hwnd;
492 if( IsWindow(hwnd) ) DestroyWindow( hwnd );
493 if (modal && ownerEnabled) DIALOG_EnableOwner(owner);
494 return 0;
498 /***********************************************************************
499 * DialogBox (USER.87)
501 INT16 WINAPI DialogBox16( HINSTANCE16 hInst, LPCSTR dlgTemplate,
502 HWND16 owner, DLGPROC16 dlgProc )
504 return DialogBoxParam16( hInst, dlgTemplate, owner, dlgProc, 0 );
508 /**************************************************************************
509 * EndDialog (USER.88)
511 BOOL16 WINAPI EndDialog16( HWND16 hwnd, INT16 retval )
513 return EndDialog( WIN_Handle32(hwnd), retval );
517 /***********************************************************************
518 * CreateDialog (USER.89)
520 HWND16 WINAPI CreateDialog16( HINSTANCE16 hInst, LPCSTR dlgTemplate,
521 HWND16 owner, DLGPROC16 dlgProc )
523 return CreateDialogParam16( hInst, dlgTemplate, owner, dlgProc, 0 );
527 /**************************************************************************
528 * GetDlgItem (USER.91)
530 HWND16 WINAPI GetDlgItem16( HWND16 hwndDlg, INT16 id )
532 return HWND_16( GetDlgItem( WIN_Handle32(hwndDlg), (UINT16) id ));
536 /**************************************************************************
537 * SetDlgItemText (USER.92)
539 void WINAPI SetDlgItemText16( HWND16 hwnd, INT16 id, SEGPTR lpString )
541 SendDlgItemMessage16( hwnd, id, WM_SETTEXT, 0, lpString );
545 /**************************************************************************
546 * GetDlgItemText (USER.93)
548 INT16 WINAPI GetDlgItemText16( HWND16 hwnd, INT16 id, SEGPTR str, UINT16 len )
550 return SendDlgItemMessage16( hwnd, id, WM_GETTEXT, len, str );
554 /**************************************************************************
555 * SetDlgItemInt (USER.94)
557 void WINAPI SetDlgItemInt16( HWND16 hwnd, INT16 id, UINT16 value, BOOL16 fSigned )
559 SetDlgItemInt( WIN_Handle32(hwnd), (UINT)(UINT16)id,
560 (UINT)(fSigned ? (INT16) value : value), fSigned );
564 /**************************************************************************
565 * GetDlgItemInt (USER.95)
567 UINT16 WINAPI GetDlgItemInt16( HWND16 hwnd, INT16 id, BOOL16 *translated, BOOL16 fSigned )
569 UINT result;
570 BOOL ok;
572 if (translated) *translated = FALSE;
573 result = GetDlgItemInt( WIN_Handle32(hwnd), (UINT)(UINT16)id, &ok, fSigned );
574 if (!ok) return 0;
575 if (fSigned)
577 if (((INT)result < -32767) || ((INT)result > 32767)) return 0;
579 else
581 if (result > 65535) return 0;
583 if (translated) *translated = TRUE;
584 return (UINT16)result;
588 /**************************************************************************
589 * CheckRadioButton (USER.96)
591 BOOL16 WINAPI CheckRadioButton16( HWND16 hwndDlg, UINT16 firstID,
592 UINT16 lastID, UINT16 checkID )
594 return CheckRadioButton( WIN_Handle32(hwndDlg), firstID, lastID, checkID );
598 /**************************************************************************
599 * CheckDlgButton (USER.97)
601 BOOL16 WINAPI CheckDlgButton16( HWND16 hwnd, INT16 id, UINT16 check )
603 SendDlgItemMessage16( hwnd, id, BM_SETCHECK16, check, 0 );
604 return TRUE;
608 /**************************************************************************
609 * IsDlgButtonChecked (USER.98)
611 UINT16 WINAPI IsDlgButtonChecked16( HWND16 hwnd, UINT16 id )
613 return (UINT16)SendDlgItemMessage16( hwnd, id, BM_GETCHECK16, 0, 0 );
617 /**************************************************************************
618 * DlgDirSelect (USER.99)
620 BOOL16 WINAPI DlgDirSelect16( HWND16 hwnd, LPSTR str, INT16 id )
622 return DlgDirSelectEx16( hwnd, str, 128, id );
626 /**************************************************************************
627 * DlgDirList (USER.100)
629 INT16 WINAPI DlgDirList16( HWND16 hDlg, LPSTR spec, INT16 idLBox,
630 INT16 idStatic, UINT16 attrib )
632 /* according to Win16 docs, DDL_DRIVES should make DDL_EXCLUSIVE
633 * be set automatically (this is different in Win32, and
634 * DIALOG_DlgDirList sends Win32 messages to the control,
635 * so do it here) */
636 if (attrib == DDL_DRIVES) attrib |= DDL_EXCLUSIVE;
637 return DlgDirListA( WIN_Handle32(hDlg), spec, idLBox, idStatic, attrib );
641 /**************************************************************************
642 * SendDlgItemMessage (USER.101)
644 LRESULT WINAPI SendDlgItemMessage16( HWND16 hwnd, INT16 id, UINT16 msg,
645 WPARAM16 wParam, LPARAM lParam )
647 HWND16 hwndCtrl = GetDlgItem16( hwnd, id );
648 if (hwndCtrl) return SendMessage16( hwndCtrl, msg, wParam, lParam );
649 else return 0;
653 /**************************************************************************
654 * MapDialogRect (USER.103)
656 void WINAPI MapDialogRect16( HWND16 hwnd, LPRECT16 rect )
658 RECT rect32 = { rect->left, rect->top, rect->right, rect->bottom };
659 MapDialogRect( WIN_Handle32(hwnd), &rect32 );
660 rect->left = rect32.left;
661 rect->right = rect32.right;
662 rect->top = rect32.top;
663 rect->bottom = rect32.bottom;
667 /**************************************************************************
668 * DlgDirSelectComboBox (USER.194)
670 BOOL16 WINAPI DlgDirSelectComboBox16( HWND16 hwnd, LPSTR str, INT16 id )
672 return DlgDirSelectComboBoxEx16( hwnd, str, 128, id );
676 /**************************************************************************
677 * DlgDirListComboBox (USER.195)
679 INT16 WINAPI DlgDirListComboBox16( HWND16 hDlg, LPSTR spec, INT16 idCBox,
680 INT16 idStatic, UINT16 attrib )
682 return DlgDirListComboBoxA( WIN_Handle32(hDlg), spec, idCBox, idStatic, attrib );
686 /***********************************************************************
687 * DialogBoxIndirect (USER.218)
689 INT16 WINAPI DialogBoxIndirect16( HINSTANCE16 hInst, HANDLE16 dlgTemplate,
690 HWND16 owner, DLGPROC16 dlgProc )
692 return DialogBoxIndirectParam16( hInst, dlgTemplate, owner, dlgProc, 0 );
696 /***********************************************************************
697 * CreateDialogIndirect (USER.219)
699 HWND16 WINAPI CreateDialogIndirect16( HINSTANCE16 hInst, LPCVOID dlgTemplate,
700 HWND16 owner, DLGPROC16 dlgProc )
702 return CreateDialogIndirectParam16( hInst, dlgTemplate, owner, dlgProc, 0);
706 /**************************************************************************
707 * GetNextDlgGroupItem (USER.227)
709 HWND16 WINAPI GetNextDlgGroupItem16( HWND16 hwndDlg, HWND16 hwndCtrl,
710 BOOL16 fPrevious )
712 return HWND_16( GetNextDlgGroupItem( WIN_Handle32(hwndDlg), WIN_Handle32(hwndCtrl), fPrevious ));
716 /**************************************************************************
717 * GetNextDlgTabItem (USER.228)
719 HWND16 WINAPI GetNextDlgTabItem16( HWND16 hwndDlg, HWND16 hwndCtrl,
720 BOOL16 fPrevious )
722 return HWND_16( GetNextDlgTabItem( WIN_Handle32(hwndDlg), WIN_Handle32(hwndCtrl), fPrevious ));
726 /***********************************************************************
727 * DialogBoxParam (USER.239)
729 INT16 WINAPI DialogBoxParam16( HINSTANCE16 hInst, LPCSTR template,
730 HWND16 owner16, DLGPROC16 dlgProc, LPARAM param )
732 HWND hwnd = 0;
733 HRSRC16 hRsrc;
734 HGLOBAL16 hmem;
735 LPCVOID data;
736 int ret = -1;
738 if (!(hRsrc = FindResource16( hInst, template, (LPSTR)RT_DIALOG ))) return 0;
739 if (!(hmem = LoadResource16( hInst, hRsrc ))) return 0;
740 if ((data = LockResource16( hmem )))
742 HWND owner = WIN_Handle32(owner16);
743 hwnd = DIALOG_CreateIndirect16( hInst, data, owner, dlgProc, param, TRUE );
744 if (hwnd) ret = wow_handlers32.dialog_box_loop( hwnd, owner );
745 GlobalUnlock16( hmem );
747 FreeResource16( hmem );
748 return ret;
752 /***********************************************************************
753 * DialogBoxIndirectParam (USER.240)
755 INT16 WINAPI DialogBoxIndirectParam16( HINSTANCE16 hInst, HANDLE16 dlgTemplate,
756 HWND16 owner16, DLGPROC16 dlgProc, LPARAM param )
758 HWND hwnd, owner = WIN_Handle32( owner16 );
759 LPCVOID ptr;
761 if (!(ptr = GlobalLock16( dlgTemplate ))) return -1;
762 hwnd = DIALOG_CreateIndirect16( hInst, ptr, owner, dlgProc, param, TRUE );
763 GlobalUnlock16( dlgTemplate );
764 if (hwnd) return wow_handlers32.dialog_box_loop( hwnd, owner );
765 return -1;
769 /***********************************************************************
770 * CreateDialogParam (USER.241)
772 HWND16 WINAPI CreateDialogParam16( HINSTANCE16 hInst, LPCSTR dlgTemplate,
773 HWND16 owner, DLGPROC16 dlgProc, LPARAM param )
775 HWND16 hwnd = 0;
776 HRSRC16 hRsrc;
777 HGLOBAL16 hmem;
778 LPCVOID data;
780 TRACE("%04x,%s,%04x,%p,%ld\n",
781 hInst, debugstr_a(dlgTemplate), owner, dlgProc, param );
783 if (!(hRsrc = FindResource16( hInst, dlgTemplate, (LPSTR)RT_DIALOG ))) return 0;
784 if (!(hmem = LoadResource16( hInst, hRsrc ))) return 0;
785 if (!(data = LockResource16( hmem ))) hwnd = 0;
786 else hwnd = CreateDialogIndirectParam16( hInst, data, owner, dlgProc, param );
787 FreeResource16( hmem );
788 return hwnd;
792 /***********************************************************************
793 * CreateDialogIndirectParam (USER.242)
795 HWND16 WINAPI CreateDialogIndirectParam16( HINSTANCE16 hInst, LPCVOID dlgTemplate,
796 HWND16 owner, DLGPROC16 dlgProc, LPARAM param )
798 if (!dlgTemplate) return 0;
799 return HWND_16( DIALOG_CreateIndirect16( hInst, dlgTemplate, WIN_Handle32(owner),
800 dlgProc, param, FALSE ));
804 /**************************************************************************
805 * DlgDirSelectEx (USER.422)
807 BOOL16 WINAPI DlgDirSelectEx16( HWND16 hwnd, LPSTR str, INT16 len, INT16 id )
809 return DlgDirSelectExA( WIN_Handle32(hwnd), str, len, id );
813 /**************************************************************************
814 * DlgDirSelectComboBoxEx (USER.423)
816 BOOL16 WINAPI DlgDirSelectComboBoxEx16( HWND16 hwnd, LPSTR str, INT16 len,
817 INT16 id )
819 return DlgDirSelectComboBoxExA( WIN_Handle32(hwnd), str, len, id );