winspool: Change CUPS printers print processor to wineps.
[wine.git] / dlls / user.exe16 / dialog.c
blob2b6731e4aaf63dbe4989c46ee40f086266df8e89
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, %08lx, %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 char *caption, caption_buf[4];
185 HINSTANCE16 instance = hInst;
186 SEGPTR segptr;
188 template = DIALOG_GetControl16( template, &info );
189 segptr = MapLS( (void *)info.data );
191 caption = (char *)info.windowName;
192 if (caption && IS_INTRESOURCE(caption))
194 caption_buf[0] = 0xff;
195 caption_buf[1] = PtrToUlong( caption );
196 caption_buf[2] = PtrToUlong( caption ) >> 8;
197 caption_buf[3] = 0;
198 caption = caption_buf;
201 hwndCtrl = WIN_Handle32( CreateWindowEx16( WS_EX_NOPARENTNOTIFY,
202 info.className, caption,
203 info.style | WS_CHILD,
204 MulDiv(info.x, dlgInfo->xBaseUnit, 4),
205 MulDiv(info.y, dlgInfo->yBaseUnit, 8),
206 MulDiv(info.cx, dlgInfo->xBaseUnit, 4),
207 MulDiv(info.cy, dlgInfo->yBaseUnit, 8),
208 HWND_16(hwnd), (HMENU16)info.id,
209 instance, (LPVOID)segptr ));
210 UnMapLS( segptr );
212 if (!hwndCtrl)
214 if (dlgTemplate->style & DS_NOFAILCREATE) continue;
215 return FALSE;
218 /* Send initialisation messages to the control */
219 if (dlgInfo->hUserFont) SendMessageA( hwndCtrl, WM_SETFONT,
220 (WPARAM)dlgInfo->hUserFont, 0 );
221 if (SendMessageA(hwndCtrl, WM_GETDLGCODE, 0, 0) & DLGC_DEFPUSHBUTTON)
223 /* If there's already a default push-button, set it back */
224 /* to normal and use this one instead. */
225 if (hwndDefButton)
226 SendMessageA( hwndDefButton, BM_SETSTYLE,
227 BS_PUSHBUTTON,FALSE );
228 hwndDefButton = hwndCtrl;
229 dlgInfo->idResult = GetWindowLongPtrA( hwndCtrl, GWLP_ID );
232 TRACE(" END\n" );
233 return TRUE;
237 /***********************************************************************
238 * DIALOG_ParseTemplate16
240 * Fill a DLG_TEMPLATE structure from the dialog template, and return
241 * a pointer to the first control.
243 static LPCSTR DIALOG_ParseTemplate16( LPCSTR p, DLG_TEMPLATE * result )
245 result->style = GET_DWORD(p); p += sizeof(DWORD);
246 result->nbItems = (unsigned char) *p++;
247 result->x = GET_WORD(p); p += sizeof(WORD);
248 result->y = GET_WORD(p); p += sizeof(WORD);
249 result->cx = GET_WORD(p); p += sizeof(WORD);
250 result->cy = GET_WORD(p); p += sizeof(WORD);
252 TRACE("DIALOG %d, %d, %d, %d\n", result->x, result->y, result->cx, result->cy );
253 TRACE(" STYLE %08lx\n", result->style );
255 /* Get the menu name */
257 switch( (BYTE)*p )
259 case 0:
260 result->menuName = 0;
261 p++;
262 break;
263 case 0xff:
264 result->menuName = MAKEINTRESOURCEA(GET_WORD( p + 1 ));
265 p += 3;
266 TRACE(" MENU %04x\n", LOWORD(result->menuName) );
267 break;
268 default:
269 result->menuName = p;
270 TRACE(" MENU '%s'\n", p );
271 p += strlen(p) + 1;
272 break;
275 /* Get the class name */
277 if (*p)
279 result->className = p;
280 TRACE(" CLASS '%s'\n", result->className );
282 else result->className = (LPCSTR)DIALOG_CLASS_ATOM;
283 p += strlen(p) + 1;
285 /* Get the window caption */
287 result->caption = p;
288 p += strlen(p) + 1;
289 TRACE(" CAPTION '%s'\n", result->caption );
291 /* Get the font name */
293 result->pointSize = 0;
294 result->faceName = NULL;
296 if (result->style & DS_SETFONT)
298 result->pointSize = GET_WORD(p);
299 p += sizeof(WORD);
300 result->faceName = p;
301 p += strlen(p) + 1;
302 TRACE(" FONT %d,'%s'\n", result->pointSize, result->faceName );
304 return p;
308 /***********************************************************************
309 * DIALOG_CreateIndirect16
311 * Creates a dialog box window
313 * modal = TRUE if we are called from a modal dialog box.
314 * (it's more compatible to do it here, as under Windows the owner
315 * is never disabled if the dialog fails because of an invalid template)
317 static HWND DIALOG_CreateIndirect16( HINSTANCE16 hInst, LPCVOID dlgTemplate,
318 HWND owner, DLGPROC16 dlgProc, LPARAM param,
319 BOOL modal )
321 HWND hwnd;
322 RECT rect;
323 POINT pos;
324 SIZE size;
325 DLG_TEMPLATE template;
326 DIALOGINFO * dlgInfo;
327 BOOL ownerEnabled = TRUE;
328 DWORD exStyle = 0;
329 DWORD units = GetDialogBaseUnits();
330 HMENU16 hMenu = 0;
331 HFONT hUserFont = 0;
332 UINT flags = 0;
333 UINT xBaseUnit = LOWORD(units);
334 UINT yBaseUnit = HIWORD(units);
336 /* Parse dialog template */
338 dlgTemplate = DIALOG_ParseTemplate16( dlgTemplate, &template );
340 /* Load menu */
342 if (template.menuName) hMenu = LoadMenu16( hInst, template.menuName );
344 /* Create custom font if needed */
346 if (template.style & DS_SETFONT)
348 /* We convert the size to pixels and then make it -ve. This works
349 * for both +ve and -ve template.pointSize */
350 HDC dc;
351 int pixels;
352 dc = GetDC(0);
353 pixels = MulDiv(template.pointSize, GetDeviceCaps(dc , LOGPIXELSY), 72);
354 hUserFont = CreateFontA( -pixels, 0, 0, 0, FW_DONTCARE,
355 FALSE, FALSE, FALSE, DEFAULT_CHARSET, 0, 0,
356 PROOF_QUALITY, FF_DONTCARE, template.faceName );
357 if (hUserFont)
359 SIZE charSize;
360 HFONT hOldFont = SelectObject( dc, hUserFont );
361 charSize.cx = GdiGetCharDimensions( dc, NULL, &charSize.cy );
362 if (charSize.cx)
364 xBaseUnit = charSize.cx;
365 yBaseUnit = charSize.cy;
367 SelectObject( dc, hOldFont );
369 ReleaseDC(0, dc);
370 TRACE("units = %d,%d\n", xBaseUnit, yBaseUnit );
373 /* Create dialog main window */
375 rect.left = rect.top = 0;
376 rect.right = MulDiv(template.cx, xBaseUnit, 4);
377 rect.bottom = MulDiv(template.cy, yBaseUnit, 8);
378 if (template.style & DS_MODALFRAME) exStyle |= WS_EX_DLGMODALFRAME;
379 AdjustWindowRectEx( &rect, template.style, (hMenu != 0), exStyle );
380 pos.x = rect.left;
381 pos.y = rect.top;
382 size.cx = rect.right - rect.left;
383 size.cy = rect.bottom - rect.top;
385 if (template.x == CW_USEDEFAULT16)
387 pos.x = pos.y = CW_USEDEFAULT16;
389 else
391 HMONITOR monitor = 0;
392 MONITORINFO mon_info;
394 mon_info.cbSize = sizeof(mon_info);
395 if (template.style & DS_CENTER)
397 monitor = MonitorFromWindow( owner ? owner : GetActiveWindow(), MONITOR_DEFAULTTOPRIMARY );
398 GetMonitorInfoW( monitor, &mon_info );
399 pos.x = (mon_info.rcWork.left + mon_info.rcWork.right - size.cx) / 2;
400 pos.y = (mon_info.rcWork.top + mon_info.rcWork.bottom - size.cy) / 2;
402 else if (template.style & DS_CENTERMOUSE)
404 GetCursorPos( &pos );
405 monitor = MonitorFromPoint( pos, MONITOR_DEFAULTTOPRIMARY );
406 GetMonitorInfoW( monitor, &mon_info );
408 else
410 pos.x += MulDiv(template.x, xBaseUnit, 4);
411 pos.y += MulDiv(template.y, yBaseUnit, 8);
412 if (!(template.style & (WS_CHILD|DS_ABSALIGN))) ClientToScreen( owner, &pos );
414 if ( !(template.style & WS_CHILD) )
416 INT dX, dY;
418 /* try to fit it into the desktop */
420 if (!monitor)
422 SetRect( &rect, pos.x, pos.y, pos.x + size.cx, pos.y + size.cy );
423 monitor = MonitorFromRect( &rect, MONITOR_DEFAULTTOPRIMARY );
424 GetMonitorInfoW( monitor, &mon_info );
426 if ((dX = pos.x + size.cx + GetSystemMetrics(SM_CXDLGFRAME) - mon_info.rcWork.right) > 0)
427 pos.x -= dX;
428 if ((dY = pos.y + size.cy + GetSystemMetrics(SM_CYDLGFRAME) - mon_info.rcWork.bottom) > 0)
429 pos.y -= dY;
430 if( pos.x < mon_info.rcWork.left ) pos.x = mon_info.rcWork.left;
431 if( pos.y < mon_info.rcWork.top ) pos.y = mon_info.rcWork.top;
435 if (modal)
437 ownerEnabled = DIALOG_DisableOwner( owner );
438 if (ownerEnabled) flags |= DF_OWNERENABLED;
441 hwnd = WIN_Handle32( CreateWindowEx16(exStyle, template.className,
442 template.caption, template.style & ~WS_VISIBLE,
443 pos.x, pos.y, size.cx, size.cy,
444 HWND_16(owner), hMenu, hInst, NULL ));
445 if (!hwnd)
447 if (hUserFont) DeleteObject( hUserFont );
448 if (hMenu) DestroyMenu16( hMenu );
449 if (modal && (flags & DF_OWNERENABLED)) DIALOG_EnableOwner(owner);
450 return 0;
452 dlgInfo = wow_handlers32.get_dialog_info( hwnd, TRUE );
453 dlgInfo->hwndFocus = 0;
454 dlgInfo->hUserFont = hUserFont;
455 dlgInfo->hMenu = HMENU_32( hMenu );
456 dlgInfo->xBaseUnit = xBaseUnit;
457 dlgInfo->yBaseUnit = yBaseUnit;
458 dlgInfo->idResult = 0;
459 dlgInfo->flags = flags;
461 SetWindowLong16( HWND_16(hwnd), DWLP_DLGPROC, (LONG)dlgProc );
463 if (hUserFont)
464 SendMessageA( hwnd, WM_SETFONT, (WPARAM)hUserFont, 0 );
466 /* Create controls */
468 if (DIALOG_CreateControls16( hwnd, dlgTemplate, &template, hInst ))
470 HWND hwndPreInitFocus;
472 /* Send initialisation messages and set focus */
474 dlgInfo->hwndFocus = GetNextDlgTabItem( hwnd, 0, FALSE );
476 hwndPreInitFocus = GetFocus();
477 if (SendMessageA( hwnd, WM_INITDIALOG, (WPARAM)dlgInfo->hwndFocus, param ))
479 /* check where the focus is again,
480 * some controls status might have changed in WM_INITDIALOG */
481 dlgInfo->hwndFocus = GetNextDlgTabItem( hwnd, 0, FALSE);
482 if( dlgInfo->hwndFocus )
483 SetFocus( dlgInfo->hwndFocus );
485 else
487 /* If the dlgproc has returned FALSE (indicating handling of keyboard focus)
488 but the focus has not changed, set the focus where we expect it. */
489 if ((GetFocus() == hwndPreInitFocus) &&
490 (GetWindowLongW( hwnd, GWL_STYLE ) & WS_VISIBLE))
492 dlgInfo->hwndFocus = GetNextDlgTabItem( hwnd, 0, FALSE);
493 if( dlgInfo->hwndFocus )
494 SetFocus( dlgInfo->hwndFocus );
498 if (template.style & WS_VISIBLE && !(GetWindowLongW( hwnd, GWL_STYLE ) & WS_VISIBLE))
500 ShowWindow( hwnd, SW_SHOWNORMAL ); /* SW_SHOW doesn't always work */
502 return hwnd;
504 if( IsWindow(hwnd) ) DestroyWindow( hwnd );
505 if (modal && ownerEnabled) DIALOG_EnableOwner(owner);
506 return 0;
510 /***********************************************************************
511 * DialogBox (USER.87)
513 INT16 WINAPI DialogBox16( HINSTANCE16 hInst, LPCSTR dlgTemplate,
514 HWND16 owner, DLGPROC16 dlgProc )
516 return DialogBoxParam16( hInst, dlgTemplate, owner, dlgProc, 0 );
520 /**************************************************************************
521 * EndDialog (USER.88)
523 BOOL16 WINAPI EndDialog16( HWND16 hwnd, INT16 retval )
525 return EndDialog( WIN_Handle32(hwnd), retval );
529 /***********************************************************************
530 * CreateDialog (USER.89)
532 HWND16 WINAPI CreateDialog16( HINSTANCE16 hInst, LPCSTR dlgTemplate,
533 HWND16 owner, DLGPROC16 dlgProc )
535 return CreateDialogParam16( hInst, dlgTemplate, owner, dlgProc, 0 );
539 /**************************************************************************
540 * GetDlgItem (USER.91)
542 HWND16 WINAPI GetDlgItem16( HWND16 hwndDlg, INT16 id )
544 return HWND_16( GetDlgItem( WIN_Handle32(hwndDlg), (UINT16) id ));
548 /**************************************************************************
549 * SetDlgItemText (USER.92)
551 void WINAPI SetDlgItemText16( HWND16 hwnd, INT16 id, SEGPTR lpString )
553 SendDlgItemMessage16( hwnd, id, WM_SETTEXT, 0, lpString );
557 /**************************************************************************
558 * GetDlgItemText (USER.93)
560 INT16 WINAPI GetDlgItemText16( HWND16 hwnd, INT16 id, SEGPTR str, UINT16 len )
562 return SendDlgItemMessage16( hwnd, id, WM_GETTEXT, len, str );
566 /**************************************************************************
567 * SetDlgItemInt (USER.94)
569 void WINAPI SetDlgItemInt16( HWND16 hwnd, INT16 id, UINT16 value, BOOL16 fSigned )
571 SetDlgItemInt( WIN_Handle32(hwnd), (UINT)(UINT16)id,
572 (UINT)(fSigned ? (INT16) value : value), fSigned );
576 /**************************************************************************
577 * GetDlgItemInt (USER.95)
579 UINT16 WINAPI GetDlgItemInt16( HWND16 hwnd, INT16 id, BOOL16 *translated, BOOL16 fSigned )
581 UINT result;
582 BOOL ok;
584 if (translated) *translated = FALSE;
585 result = GetDlgItemInt( WIN_Handle32(hwnd), (UINT)(UINT16)id, &ok, fSigned );
586 if (!ok) return 0;
587 if (fSigned)
589 if (((INT)result < -32767) || ((INT)result > 32767)) return 0;
591 else
593 if (result > 65535) return 0;
595 if (translated) *translated = TRUE;
596 return (UINT16)result;
600 /**************************************************************************
601 * CheckRadioButton (USER.96)
603 BOOL16 WINAPI CheckRadioButton16( HWND16 hwndDlg, UINT16 firstID,
604 UINT16 lastID, UINT16 checkID )
606 return CheckRadioButton( WIN_Handle32(hwndDlg), firstID, lastID, checkID );
610 /**************************************************************************
611 * CheckDlgButton (USER.97)
613 BOOL16 WINAPI CheckDlgButton16( HWND16 hwnd, INT16 id, UINT16 check )
615 SendDlgItemMessage16( hwnd, id, BM_SETCHECK16, check, 0 );
616 return TRUE;
620 /**************************************************************************
621 * IsDlgButtonChecked (USER.98)
623 UINT16 WINAPI IsDlgButtonChecked16( HWND16 hwnd, UINT16 id )
625 return (UINT16)SendDlgItemMessage16( hwnd, id, BM_GETCHECK16, 0, 0 );
629 /**************************************************************************
630 * DlgDirSelect (USER.99)
632 BOOL16 WINAPI DlgDirSelect16( HWND16 hwnd, LPSTR str, INT16 id )
634 return DlgDirSelectEx16( hwnd, str, 128, id );
638 /**************************************************************************
639 * DlgDirList (USER.100)
641 INT16 WINAPI DlgDirList16( HWND16 hDlg, LPSTR spec, INT16 idLBox,
642 INT16 idStatic, UINT16 attrib )
644 /* according to Win16 docs, DDL_DRIVES should make DDL_EXCLUSIVE
645 * be set automatically (this is different in Win32, and
646 * DIALOG_DlgDirList sends Win32 messages to the control,
647 * so do it here) */
648 if (attrib == DDL_DRIVES) attrib |= DDL_EXCLUSIVE;
649 return DlgDirListA( WIN_Handle32(hDlg), spec, idLBox, idStatic, attrib );
653 /**************************************************************************
654 * SendDlgItemMessage (USER.101)
656 LRESULT WINAPI SendDlgItemMessage16( HWND16 hwnd, INT16 id, UINT16 msg,
657 WPARAM16 wParam, LPARAM lParam )
659 HWND16 hwndCtrl = GetDlgItem16( hwnd, id );
660 if (hwndCtrl) return SendMessage16( hwndCtrl, msg, wParam, lParam );
661 else return 0;
665 /**************************************************************************
666 * MapDialogRect (USER.103)
668 void WINAPI MapDialogRect16( HWND16 hwnd, LPRECT16 rect )
670 RECT rect32 = { rect->left, rect->top, rect->right, rect->bottom };
671 MapDialogRect( WIN_Handle32(hwnd), &rect32 );
672 rect->left = rect32.left;
673 rect->right = rect32.right;
674 rect->top = rect32.top;
675 rect->bottom = rect32.bottom;
679 /**************************************************************************
680 * DlgDirSelectComboBox (USER.194)
682 BOOL16 WINAPI DlgDirSelectComboBox16( HWND16 hwnd, LPSTR str, INT16 id )
684 return DlgDirSelectComboBoxEx16( hwnd, str, 128, id );
688 /**************************************************************************
689 * DlgDirListComboBox (USER.195)
691 INT16 WINAPI DlgDirListComboBox16( HWND16 hDlg, LPSTR spec, INT16 idCBox,
692 INT16 idStatic, UINT16 attrib )
694 return DlgDirListComboBoxA( WIN_Handle32(hDlg), spec, idCBox, idStatic, attrib );
698 /***********************************************************************
699 * DialogBoxIndirect (USER.218)
701 INT16 WINAPI DialogBoxIndirect16( HINSTANCE16 hInst, HANDLE16 dlgTemplate,
702 HWND16 owner, DLGPROC16 dlgProc )
704 return DialogBoxIndirectParam16( hInst, dlgTemplate, owner, dlgProc, 0 );
708 /***********************************************************************
709 * CreateDialogIndirect (USER.219)
711 HWND16 WINAPI CreateDialogIndirect16( HINSTANCE16 hInst, LPCVOID dlgTemplate,
712 HWND16 owner, DLGPROC16 dlgProc )
714 return CreateDialogIndirectParam16( hInst, dlgTemplate, owner, dlgProc, 0);
718 /**************************************************************************
719 * GetNextDlgGroupItem (USER.227)
721 HWND16 WINAPI GetNextDlgGroupItem16( HWND16 hwndDlg, HWND16 hwndCtrl,
722 BOOL16 fPrevious )
724 return HWND_16( GetNextDlgGroupItem( WIN_Handle32(hwndDlg), WIN_Handle32(hwndCtrl), fPrevious ));
728 /**************************************************************************
729 * GetNextDlgTabItem (USER.228)
731 HWND16 WINAPI GetNextDlgTabItem16( HWND16 hwndDlg, HWND16 hwndCtrl,
732 BOOL16 fPrevious )
734 return HWND_16( GetNextDlgTabItem( WIN_Handle32(hwndDlg), WIN_Handle32(hwndCtrl), fPrevious ));
738 /***********************************************************************
739 * DialogBoxParam (USER.239)
741 INT16 WINAPI DialogBoxParam16( HINSTANCE16 hInst, LPCSTR template,
742 HWND16 owner16, DLGPROC16 dlgProc, LPARAM param )
744 HWND hwnd = 0;
745 HRSRC16 hRsrc;
746 HGLOBAL16 hmem;
747 LPCVOID data;
748 int ret = -1;
750 if (!(hRsrc = FindResource16( hInst, template, (LPSTR)RT_DIALOG ))) return 0;
751 if (!(hmem = LoadResource16( hInst, hRsrc ))) return 0;
752 if ((data = LockResource16( hmem )))
754 HWND owner = WIN_Handle32(owner16);
755 hwnd = DIALOG_CreateIndirect16( hInst, data, owner, dlgProc, param, TRUE );
756 if (hwnd) ret = wow_handlers32.dialog_box_loop( hwnd, owner );
757 GlobalUnlock16( hmem );
759 FreeResource16( hmem );
760 return ret;
764 /***********************************************************************
765 * DialogBoxIndirectParam (USER.240)
767 INT16 WINAPI DialogBoxIndirectParam16( HINSTANCE16 hInst, HANDLE16 dlgTemplate,
768 HWND16 owner16, DLGPROC16 dlgProc, LPARAM param )
770 HWND hwnd, owner = WIN_Handle32( owner16 );
771 LPCVOID ptr;
773 if (!(ptr = GlobalLock16( dlgTemplate ))) return -1;
774 hwnd = DIALOG_CreateIndirect16( hInst, ptr, owner, dlgProc, param, TRUE );
775 GlobalUnlock16( dlgTemplate );
776 if (hwnd) return wow_handlers32.dialog_box_loop( hwnd, owner );
777 return -1;
781 /***********************************************************************
782 * CreateDialogParam (USER.241)
784 HWND16 WINAPI CreateDialogParam16( HINSTANCE16 hInst, LPCSTR dlgTemplate,
785 HWND16 owner, DLGPROC16 dlgProc, LPARAM param )
787 HWND16 hwnd = 0;
788 HRSRC16 hRsrc;
789 HGLOBAL16 hmem;
790 LPCVOID data;
792 TRACE("%04x,%s,%04x,%p,%Ix\n",
793 hInst, debugstr_a(dlgTemplate), owner, dlgProc, param );
795 if (!(hRsrc = FindResource16( hInst, dlgTemplate, (LPSTR)RT_DIALOG ))) return 0;
796 if (!(hmem = LoadResource16( hInst, hRsrc ))) return 0;
797 if (!(data = LockResource16( hmem ))) hwnd = 0;
798 else hwnd = CreateDialogIndirectParam16( hInst, data, owner, dlgProc, param );
799 FreeResource16( hmem );
800 return hwnd;
804 /***********************************************************************
805 * CreateDialogIndirectParam (USER.242)
807 HWND16 WINAPI CreateDialogIndirectParam16( HINSTANCE16 hInst, LPCVOID dlgTemplate,
808 HWND16 owner, DLGPROC16 dlgProc, LPARAM param )
810 if (!dlgTemplate) return 0;
811 return HWND_16( DIALOG_CreateIndirect16( hInst, dlgTemplate, WIN_Handle32(owner),
812 dlgProc, param, FALSE ));
816 /**************************************************************************
817 * DlgDirSelectEx (USER.422)
819 BOOL16 WINAPI DlgDirSelectEx16( HWND16 hwnd, LPSTR str, INT16 len, INT16 id )
821 return DlgDirSelectExA( WIN_Handle32(hwnd), str, len, id );
825 /**************************************************************************
826 * DlgDirSelectComboBoxEx (USER.423)
828 BOOL16 WINAPI DlgDirSelectComboBoxEx16( HWND16 hwnd, LPSTR str, INT16 len,
829 INT16 id )
831 return DlgDirSelectComboBoxExA( WIN_Handle32(hwnd), str, len, id );