d3dx9/tests: Implemented ConvertAdjacencyToPointReps test.
[wine/multimedia.git] / dlls / user.exe16 / dialog.c
bloba194a586900b0e698f59099ab32c141fc17c6ae6
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->idResult = 0;
450 dlgInfo->flags = flags;
452 SetWindowLong16( HWND_16(hwnd), DWLP_DLGPROC, (LONG)dlgProc );
454 if (hUserFont)
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 );
476 else
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 */
493 return hwnd;
495 if( IsWindow(hwnd) ) DestroyWindow( hwnd );
496 if (modal && ownerEnabled) DIALOG_EnableOwner(owner);
497 return 0;
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 )
572 UINT result;
573 BOOL ok;
575 if (translated) *translated = FALSE;
576 result = GetDlgItemInt( WIN_Handle32(hwnd), (UINT)(UINT16)id, &ok, fSigned );
577 if (!ok) return 0;
578 if (fSigned)
580 if (((INT)result < -32767) || ((INT)result > 32767)) return 0;
582 else
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 );
607 return TRUE;
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,
638 * so do it here) */
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 );
652 else return 0;
656 /**************************************************************************
657 * MapDialogRect (USER.103)
659 void WINAPI MapDialogRect16( HWND16 hwnd, LPRECT16 rect )
661 RECT rect32;
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,
713 BOOL16 fPrevious )
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,
723 BOOL16 fPrevious )
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 )
735 HWND hwnd = 0;
736 HRSRC16 hRsrc;
737 HGLOBAL16 hmem;
738 LPCVOID data;
739 int ret = -1;
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 );
751 return ret;
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 );
762 LPCVOID ptr;
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 );
768 return -1;
772 /***********************************************************************
773 * CreateDialogParam (USER.241)
775 HWND16 WINAPI CreateDialogParam16( HINSTANCE16 hInst, LPCSTR dlgTemplate,
776 HWND16 owner, DLGPROC16 dlgProc, LPARAM param )
778 HWND16 hwnd = 0;
779 HRSRC16 hRsrc;
780 HGLOBAL16 hmem;
781 LPCVOID data;
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 );
791 return hwnd;
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,
820 INT16 id )
822 return DlgDirSelectComboBoxExA( WIN_Handle32(hwnd), str, len, id );