blob: 49f42ce5cc40af72710599779c13a47bd72e4993 [file] [log] [blame]
Alexandre Julliard0e607781993-11-03 19:23:37 +00001/*
2 * Dialog functions
3 *
Alexandre Julliard1e9ac791996-06-06 18:38:27 +00004 * Copyright 1993, 1994, 1996 Alexandre Julliard
Alexandre Julliard59730ae1996-03-24 16:20:51 +00005 */
Alexandre Julliard0e607781993-11-03 19:23:37 +00006
Alexandre Julliardda0cfb31996-12-01 17:17:47 +00007#include <ctype.h>
Alexandre Julliardd30dfd21998-09-27 18:28:36 +00008#include <sys/errno.h>
Alexandre Julliard01d63461997-01-20 19:43:45 +00009#include <limits.h>
Alexandre Julliard8d24ae61994-04-05 21:42:43 +000010#include <stdlib.h>
Alexandre Julliard8d24ae61994-04-05 21:42:43 +000011#include <string.h>
Alexandre Julliard0e607781993-11-03 19:23:37 +000012#include "windows.h"
13#include "dialog.h"
Alexandre Julliardda0cfb31996-12-01 17:17:47 +000014#include "drive.h"
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +000015#include "heap.h"
Alexandre Julliard0e607781993-11-03 19:23:37 +000016#include "win.h"
Alexandre Julliarde2abbb11995-03-19 17:39:39 +000017#include "ldt.h"
Alexandre Julliarddba420a1994-02-02 06:48:31 +000018#include "user.h"
Alexandre Julliard1e9ac791996-06-06 18:38:27 +000019#include "winproc.h"
Alexandre Julliard3f2abfa1994-08-16 15:43:11 +000020#include "message.h"
Alexandre Julliardda0cfb31996-12-01 17:17:47 +000021#include "sysmetrics.h"
Alexandre Julliardaca05781994-10-17 18:12:41 +000022#include "debug.h"
Alexandre Julliard0e607781993-11-03 19:23:37 +000023
Alexandre Julliard1e9ac791996-06-06 18:38:27 +000024
25 /* Dialog control information */
26typedef struct
27{
28 DWORD style;
29 DWORD exStyle;
Alexandre Julliardc7c217b1998-04-13 12:21:30 +000030 DWORD helpId;
Alexandre Julliard1e9ac791996-06-06 18:38:27 +000031 INT16 x;
32 INT16 y;
33 INT16 cx;
34 INT16 cy;
Alexandre Julliardc7c217b1998-04-13 12:21:30 +000035 UINT32 id;
Alexandre Julliard1e9ac791996-06-06 18:38:27 +000036 LPCSTR className;
37 LPCSTR windowName;
38 LPVOID data;
39} DLG_CONTROL_INFO;
40
41 /* Dialog template */
42typedef struct
43{
44 DWORD style;
45 DWORD exStyle;
Alexandre Julliardc7c217b1998-04-13 12:21:30 +000046 DWORD helpId;
Alexandre Julliard1e9ac791996-06-06 18:38:27 +000047 UINT16 nbItems;
48 INT16 x;
49 INT16 y;
50 INT16 cx;
51 INT16 cy;
52 LPCSTR menuName;
53 LPCSTR className;
54 LPCSTR caption;
55 WORD pointSize;
Alexandre Julliardc7c217b1998-04-13 12:21:30 +000056 WORD weight;
57 BOOL32 italic;
Alexandre Julliard1e9ac791996-06-06 18:38:27 +000058 LPCSTR faceName;
Alexandre Julliardc7c217b1998-04-13 12:21:30 +000059 BOOL32 dialogEx;
Alexandre Julliard1e9ac791996-06-06 18:38:27 +000060} DLG_TEMPLATE;
61
Alexandre Julliard0e607781993-11-03 19:23:37 +000062 /* Dialog base units */
Alexandre Julliard1e9ac791996-06-06 18:38:27 +000063static WORD xBaseUnit = 0, yBaseUnit = 0;
Alexandre Julliard0e607781993-11-03 19:23:37 +000064
65
66/***********************************************************************
67 * DIALOG_Init
68 *
69 * Initialisation of the dialog manager.
70 */
Alexandre Julliard44ed71f1997-12-21 19:17:50 +000071BOOL32 DIALOG_Init(void)
Alexandre Julliard0e607781993-11-03 19:23:37 +000072{
Alexandre Julliardd90840e1996-06-11 16:02:08 +000073 TEXTMETRIC16 tm;
Alexandre Julliard530ee841996-10-23 16:59:13 +000074 HDC16 hdc;
Alexandre Julliard0e607781993-11-03 19:23:37 +000075
76 /* Calculate the dialog base units */
77
Alexandre Julliardb1bac321996-12-15 19:45:59 +000078 if (!(hdc = CreateDC16( "DISPLAY", NULL, NULL, NULL ))) return FALSE;
Alexandre Julliard3051b641996-07-05 17:14:13 +000079 GetTextMetrics16( hdc, &tm );
Alexandre Julliard7ebe1a41996-12-22 18:27:48 +000080 DeleteDC32( hdc );
Alexandre Julliard0e607781993-11-03 19:23:37 +000081 xBaseUnit = tm.tmAveCharWidth;
82 yBaseUnit = tm.tmHeight;
Alexandre Julliard7cbe6571995-01-09 18:21:16 +000083
84 /* Dialog units are based on a proportional system font */
85 /* so we adjust them a bit for a fixed font. */
Alexandre Julliardb1bac321996-12-15 19:45:59 +000086 if (!(tm.tmPitchAndFamily & TMPF_FIXED_PITCH))
87 xBaseUnit = xBaseUnit * 5 / 4;
Alexandre Julliard7cbe6571995-01-09 18:21:16 +000088
Alexandre Julliarda69b88b1998-03-15 20:29:56 +000089 TRACE(dialog, "base units = %d,%d\n",
Alexandre Julliard7cbe6571995-01-09 18:21:16 +000090 xBaseUnit, yBaseUnit );
Alexandre Julliard0e607781993-11-03 19:23:37 +000091 return TRUE;
92}
93
94
95/***********************************************************************
Alexandre Julliard1e9ac791996-06-06 18:38:27 +000096 * DIALOG_GetControl16
Alexandre Julliard0e607781993-11-03 19:23:37 +000097 *
98 * Return the class and text of the control pointed to by ptr,
Alexandre Julliard329f0681996-04-14 13:21:20 +000099 * fill the header structure and return a pointer to the next control.
Alexandre Julliard0e607781993-11-03 19:23:37 +0000100 */
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000101static LPCSTR DIALOG_GetControl16( LPCSTR p, DLG_CONTROL_INFO *info )
Alexandre Julliard0e607781993-11-03 19:23:37 +0000102{
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000103 static char buffer[10];
Alexandre Julliard03468f71998-02-15 19:40:49 +0000104 int int_id;
Alexandre Julliardff8331e1995-09-18 11:19:54 +0000105
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000106 info->x = GET_WORD(p); p += sizeof(WORD);
107 info->y = GET_WORD(p); p += sizeof(WORD);
108 info->cx = GET_WORD(p); p += sizeof(WORD);
109 info->cy = GET_WORD(p); p += sizeof(WORD);
110 info->id = GET_WORD(p); p += sizeof(WORD);
111 info->style = GET_DWORD(p); p += sizeof(DWORD);
112 info->exStyle = 0;
Alexandre Julliard7e50df31994-08-06 11:22:41 +0000113
Alexandre Julliard0e607781993-11-03 19:23:37 +0000114 if (*p & 0x80)
115 {
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000116 switch((BYTE)*p)
117 {
118 case 0x80: strcpy( buffer, "BUTTON" ); break;
119 case 0x81: strcpy( buffer, "EDIT" ); break;
120 case 0x82: strcpy( buffer, "STATIC" ); break;
121 case 0x83: strcpy( buffer, "LISTBOX" ); break;
122 case 0x84: strcpy( buffer, "SCROLLBAR" ); break;
123 case 0x85: strcpy( buffer, "COMBOBOX" ); break;
124 default: buffer[0] = '\0'; break;
125 }
126 info->className = buffer;
Alexandre Julliardff8331e1995-09-18 11:19:54 +0000127 p++;
Alexandre Julliard0e607781993-11-03 19:23:37 +0000128 }
129 else
130 {
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000131 info->className = p;
Alexandre Julliard0e607781993-11-03 19:23:37 +0000132 p += strlen(p) + 1;
133 }
Alexandre Julliardff8331e1995-09-18 11:19:54 +0000134
Alexandre Julliard03468f71998-02-15 19:40:49 +0000135 int_id = ((BYTE)*p == 0xff);
136 if (int_id)
Alexandre Julliard940d58c1994-09-16 09:24:37 +0000137 {
138 /* Integer id, not documented (?). Only works for SS_ICON controls */
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000139 info->windowName = (LPCSTR)(UINT32)GET_WORD(p+1);
140 p += 3;
Alexandre Julliard940d58c1994-09-16 09:24:37 +0000141 }
142 else
143 {
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000144 info->windowName = p;
145 p += strlen(p) + 1;
Alexandre Julliard7e50df31994-08-06 11:22:41 +0000146 }
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000147
Alexandre Julliardd90840e1996-06-11 16:02:08 +0000148 info->data = (LPVOID)(*p ? p + 1 : NULL); /* FIXME: should be a segptr */
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000149 p += *p + 1;
150
Alexandre Julliard03468f71998-02-15 19:40:49 +0000151 if(int_id)
Alexandre Julliarda69b88b1998-03-15 20:29:56 +0000152 TRACE(dialog," %s %04x %d, %d, %d, %d, %d, %08lx, %08lx\n",
Alexandre Julliard03468f71998-02-15 19:40:49 +0000153 info->className, LOWORD(info->windowName),
154 info->id, info->x, info->y, info->cx, info->cy,
155 info->style, (DWORD)info->data);
156 else
Alexandre Julliarda69b88b1998-03-15 20:29:56 +0000157 TRACE(dialog," %s '%s' %d, %d, %d, %d, %d, %08lx, %08lx\n",
Alexandre Julliard03468f71998-02-15 19:40:49 +0000158 info->className, info->windowName,
159 info->id, info->x, info->y, info->cx, info->cy,
160 info->style, (DWORD)info->data);
161
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000162 return p;
Alexandre Julliard0e607781993-11-03 19:23:37 +0000163}
164
165
166/***********************************************************************
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000167 * DIALOG_GetControl32
Alexandre Julliard0e607781993-11-03 19:23:37 +0000168 *
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000169 * Return the class and text of the control pointed to by ptr,
170 * fill the header structure and return a pointer to the next control.
Alexandre Julliard0e607781993-11-03 19:23:37 +0000171 */
Alexandre Julliardc7c217b1998-04-13 12:21:30 +0000172static const WORD *DIALOG_GetControl32( const WORD *p, DLG_CONTROL_INFO *info,
173 BOOL32 dialogEx )
Alexandre Julliard0e607781993-11-03 19:23:37 +0000174{
Alexandre Julliardc7c217b1998-04-13 12:21:30 +0000175 if (dialogEx)
176 {
177 info->helpId = GET_DWORD(p); p += 2;
178 info->exStyle = GET_DWORD(p); p += 2;
179 info->style = GET_DWORD(p); p += 2;
180 }
181 else
182 {
183 info->helpId = 0;
184 info->style = GET_DWORD(p); p += 2;
185 info->exStyle = GET_DWORD(p); p += 2;
186 }
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000187 info->x = GET_WORD(p); p++;
188 info->y = GET_WORD(p); p++;
189 info->cx = GET_WORD(p); p++;
190 info->cy = GET_WORD(p); p++;
Alexandre Julliardc7c217b1998-04-13 12:21:30 +0000191
192 if (dialogEx)
193 {
194 /* id is a DWORD for DIALOGEX */
195 info->id = GET_DWORD(p);
196 p += 2;
197 }
198 else
199 {
200 info->id = GET_WORD(p);
201 p++;
202 }
Alexandre Julliard0e607781993-11-03 19:23:37 +0000203
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000204 if (GET_WORD(p) == 0xffff)
Alexandre Julliard0e607781993-11-03 19:23:37 +0000205 {
Alexandre Julliardc7c217b1998-04-13 12:21:30 +0000206 static const WCHAR class_names[6][10] =
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000207 {
Alexandre Julliardc7c217b1998-04-13 12:21:30 +0000208 { 'B','u','t','t','o','n', }, /* 0x80 */
209 { 'E','d','i','t', }, /* 0x81 */
210 { 'S','t','a','t','i','c', }, /* 0x82 */
211 { 'L','i','s','t','B','o','x', }, /* 0x83 */
212 { 'S','c','r','o','l','l','B','a','r', }, /* 0x84 */
213 { 'C','o','m','b','o','B','o','x', } /* 0x85 */
214 };
215 WORD id = GET_WORD(p+1);
216 if ((id >= 0x80) && (id <= 0x85))
217 info->className = (LPCSTR)class_names[id - 0x80];
218 else
219 {
220 info->className = NULL;
221 ERR( dialog, "Unknown built-in class id %04x\n", id );
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000222 }
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000223 p += 2;
Alexandre Julliardff8331e1995-09-18 11:19:54 +0000224 }
225 else
226 {
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000227 info->className = (LPCSTR)p;
Alexandre Julliardd90840e1996-06-11 16:02:08 +0000228 p += lstrlen32W( (LPCWSTR)p ) + 1;
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000229 }
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000230
Alexandre Julliardc7c217b1998-04-13 12:21:30 +0000231 if (GET_WORD(p) == 0xffff) /* Is it an integer id? */
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000232 {
Alexandre Julliardc7c217b1998-04-13 12:21:30 +0000233 info->windowName = (LPCSTR)(UINT32)GET_WORD(p + 1);
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000234 p += 2;
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000235 }
236 else
237 {
238 info->windowName = (LPCSTR)p;
Alexandre Julliardd90840e1996-06-11 16:02:08 +0000239 p += lstrlen32W( (LPCWSTR)p ) + 1;
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000240 }
241
Alexandre Julliardc7c217b1998-04-13 12:21:30 +0000242 TRACE(dialog," %s %s %d, %d, %d, %d, %d, %08lx, %08lx, %08lx\n",
243 debugstr_w( (LPCWSTR)info->className ),
244 debugres_w( (LPCWSTR)info->windowName ),
245 info->id, info->x, info->y, info->cx, info->cy,
246 info->style, info->exStyle, info->helpId );
247
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000248 if (GET_WORD(p))
249 {
Alexandre Julliardc7c217b1998-04-13 12:21:30 +0000250 if (TRACE_ON(dialog))
251 {
252 WORD i, count = GET_WORD(p) / sizeof(WORD);
253 TRACE(dialog, " BEGIN\n");
254 TRACE(dialog, " ");
255 for (i = 0; i < count; i++) DUMP( "%04x,", GET_WORD(p+i+1) );
256 DUMP("\n");
257 TRACE(dialog, " END\n" );
258 }
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000259 info->data = (LPVOID)(p + 1);
260 p += GET_WORD(p) / sizeof(WORD);
261 }
262 else info->data = NULL;
263 p++;
264
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000265 /* Next control is on dword boundary */
266 return (const WORD *)((((int)p) + 3) & ~3);
267}
268
269
270/***********************************************************************
271 * DIALOG_CreateControls
272 *
273 * Create the control windows for a dialog.
274 */
Alexandre Julliardc7c217b1998-04-13 12:21:30 +0000275static BOOL32 DIALOG_CreateControls( WND *pWnd, LPCSTR template,
276 const DLG_TEMPLATE *dlgTemplate,
Alexandre Julliard01d63461997-01-20 19:43:45 +0000277 HINSTANCE32 hInst, BOOL32 win32 )
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000278{
279 DIALOGINFO *dlgInfo = (DIALOGINFO *)pWnd->wExtra;
280 DLG_CONTROL_INFO info;
281 HWND32 hwndCtrl, hwndDefButton = 0;
Alexandre Julliardc7c217b1998-04-13 12:21:30 +0000282 INT32 items = dlgTemplate->nbItems;
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000283
Alexandre Julliarda69b88b1998-03-15 20:29:56 +0000284 TRACE(dialog, " BEGIN\n" );
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000285 while (items--)
286 {
287 if (!win32)
288 {
289 HINSTANCE16 instance;
290 template = DIALOG_GetControl16( template, &info );
291 if (HIWORD(info.className) && !strcmp( info.className, "EDIT") &&
Alexandre Julliard139a4b11996-11-02 14:24:07 +0000292 ((pWnd->dwStyle & DS_LOCALEDIT) != DS_LOCALEDIT))
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000293 {
294 if (!dlgInfo->hDialogHeap)
295 {
296 dlgInfo->hDialogHeap = GlobalAlloc16(GMEM_FIXED, 0x10000);
297 if (!dlgInfo->hDialogHeap)
298 {
Alexandre Julliarda845b881998-06-01 10:44:35 +0000299 ERR(dialog, "Insufficient memory to create heap for edit control\n" );
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000300 continue;
301 }
302 LocalInit(dlgInfo->hDialogHeap, 0, 0xffff);
303 }
304 instance = dlgInfo->hDialogHeap;
305 }
306 else instance = (HINSTANCE16)hInst;
307
308 hwndCtrl = CreateWindowEx16( info.exStyle | WS_EX_NOPARENTNOTIFY,
309 info.className, info.windowName,
310 info.style | WS_CHILD,
311 info.x * dlgInfo->xBaseUnit / 4,
312 info.y * dlgInfo->yBaseUnit / 8,
313 info.cx * dlgInfo->xBaseUnit / 4,
314 info.cy * dlgInfo->yBaseUnit / 8,
Alexandre Julliardbf9130a1996-10-13 17:45:47 +0000315 pWnd->hwndSelf, (HMENU16)info.id,
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000316 instance, info.data );
317 }
318 else
319 {
Alexandre Julliardc7c217b1998-04-13 12:21:30 +0000320 template = (LPCSTR)DIALOG_GetControl32( (WORD *)template, &info,
321 dlgTemplate->dialogEx );
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000322 hwndCtrl = CreateWindowEx32W( info.exStyle | WS_EX_NOPARENTNOTIFY,
323 (LPCWSTR)info.className,
324 (LPCWSTR)info.windowName,
325 info.style | WS_CHILD,
326 info.x * dlgInfo->xBaseUnit / 4,
327 info.y * dlgInfo->yBaseUnit / 8,
328 info.cx * dlgInfo->xBaseUnit / 4,
329 info.cy * dlgInfo->yBaseUnit / 8,
Alexandre Julliardbf9130a1996-10-13 17:45:47 +0000330 pWnd->hwndSelf, (HMENU32)info.id,
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000331 hInst, info.data );
332 }
333 if (!hwndCtrl) return FALSE;
334
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000335 /* Send initialisation messages to the control */
336 if (dlgInfo->hUserFont) SendMessage32A( hwndCtrl, WM_SETFONT,
Alexandre Julliard530ee841996-10-23 16:59:13 +0000337 (WPARAM32)dlgInfo->hUserFont, 0 );
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000338 if (SendMessage32A(hwndCtrl, WM_GETDLGCODE, 0, 0) & DLGC_DEFPUSHBUTTON)
339 {
340 /* If there's already a default push-button, set it back */
341 /* to normal and use this one instead. */
342 if (hwndDefButton)
343 SendMessage32A( hwndDefButton, BM_SETSTYLE32,
344 BS_PUSHBUTTON,FALSE );
345 hwndDefButton = hwndCtrl;
Alexandre Julliard21979011997-03-05 08:22:35 +0000346 dlgInfo->idResult = GetWindowWord32( hwndCtrl, GWW_ID );
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000347 }
348 }
Alexandre Julliarda69b88b1998-03-15 20:29:56 +0000349 TRACE(dialog, " END\n" );
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000350 return TRUE;
351}
352
353
354/***********************************************************************
355 * DIALOG_ParseTemplate16
356 *
357 * Fill a DLG_TEMPLATE structure from the dialog template, and return
358 * a pointer to the first control.
359 */
360static LPCSTR DIALOG_ParseTemplate16( LPCSTR p, DLG_TEMPLATE * result )
361{
362 result->style = GET_DWORD(p); p += sizeof(DWORD);
363 result->exStyle = 0;
364 result->nbItems = *p++;
365 result->x = GET_WORD(p); p += sizeof(WORD);
366 result->y = GET_WORD(p); p += sizeof(WORD);
367 result->cx = GET_WORD(p); p += sizeof(WORD);
368 result->cy = GET_WORD(p); p += sizeof(WORD);
Alexandre Julliarda69b88b1998-03-15 20:29:56 +0000369 TRACE(dialog, "DIALOG %d, %d, %d, %d\n",
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000370 result->x, result->y, result->cx, result->cy );
Alexandre Julliarda69b88b1998-03-15 20:29:56 +0000371 TRACE(dialog, " STYLE %08lx\n", result->style );
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000372
373 /* Get the menu name */
374
375 switch( (BYTE)*p )
376 {
377 case 0:
Alexandre Julliardff8331e1995-09-18 11:19:54 +0000378 result->menuName = 0;
379 p++;
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000380 break;
381 case 0xff:
382 result->menuName = (LPCSTR)(UINT32)GET_WORD( p + 1 );
383 p += 3;
Alexandre Julliarda69b88b1998-03-15 20:29:56 +0000384 TRACE(dialog, " MENU %04x\n", LOWORD(result->menuName) );
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000385 break;
386 default:
387 result->menuName = p;
Alexandre Julliarda69b88b1998-03-15 20:29:56 +0000388 TRACE(dialog, " MENU '%s'\n", p );
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000389 p += strlen(p) + 1;
390 break;
Alexandre Julliard0e607781993-11-03 19:23:37 +0000391 }
Alexandre Julliard0e607781993-11-03 19:23:37 +0000392
Alexandre Julliardff8331e1995-09-18 11:19:54 +0000393 /* Get the class name */
394
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000395 if (*p)
396 {
397 result->className = p;
Alexandre Julliarda69b88b1998-03-15 20:29:56 +0000398 TRACE(dialog, " CLASS '%s'\n", result->className );
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000399 }
Alexandre Julliardff8331e1995-09-18 11:19:54 +0000400 else result->className = DIALOG_CLASS_ATOM;
401 p += strlen(p) + 1;
402
403 /* Get the window caption */
404
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000405 result->caption = p;
Alexandre Julliardff8331e1995-09-18 11:19:54 +0000406 p += strlen(p) + 1;
Alexandre Julliarda69b88b1998-03-15 20:29:56 +0000407 TRACE(dialog, " CAPTION '%s'\n", result->caption );
Alexandre Julliardff8331e1995-09-18 11:19:54 +0000408
409 /* Get the font name */
410
Alexandre Julliard329f0681996-04-14 13:21:20 +0000411 if (result->style & DS_SETFONT)
Alexandre Julliardff8331e1995-09-18 11:19:54 +0000412 {
Alexandre Julliard329f0681996-04-14 13:21:20 +0000413 result->pointSize = GET_WORD(p);
Alexandre Julliardff8331e1995-09-18 11:19:54 +0000414 p += sizeof(WORD);
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000415 result->faceName = p;
Alexandre Julliardff8331e1995-09-18 11:19:54 +0000416 p += strlen(p) + 1;
Alexandre Julliarda69b88b1998-03-15 20:29:56 +0000417 TRACE(dialog, " FONT %d,'%s'\n",
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000418 result->pointSize, result->faceName );
419 }
420 return p;
421}
422
423
424/***********************************************************************
425 * DIALOG_ParseTemplate32
426 *
427 * Fill a DLG_TEMPLATE structure from the dialog template, and return
428 * a pointer to the first control.
429 */
430static LPCSTR DIALOG_ParseTemplate32( LPCSTR template, DLG_TEMPLATE * result )
431{
432 const WORD *p = (const WORD *)template;
433
Alexandre Julliardc7c217b1998-04-13 12:21:30 +0000434 result->style = GET_DWORD(p); p += 2;
435 if (result->style == 0xffff0001) /* DIALOGEX resource */
436 {
437 result->dialogEx = TRUE;
438 result->helpId = GET_DWORD(p); p += 2;
439 result->exStyle = GET_DWORD(p); p += 2;
440 result->style = GET_DWORD(p); p += 2;
441 }
442 else
443 {
444 result->dialogEx = FALSE;
445 result->helpId = 0;
446 result->exStyle = GET_DWORD(p); p += 2;
447 }
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000448 result->nbItems = GET_WORD(p); p++;
449 result->x = GET_WORD(p); p++;
450 result->y = GET_WORD(p); p++;
451 result->cx = GET_WORD(p); p++;
452 result->cy = GET_WORD(p); p++;
Alexandre Julliardc7c217b1998-04-13 12:21:30 +0000453 TRACE( dialog, "DIALOG%s %d, %d, %d, %d, %ld\n",
454 result->dialogEx ? "EX" : "", result->x, result->y,
455 result->cx, result->cy, result->helpId );
456 TRACE( dialog, " STYLE 0x%08lx\n", result->style );
457 TRACE( dialog, " EXSTYLE 0x%08lx\n", result->exStyle );
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000458
459 /* Get the menu name */
460
461 switch(GET_WORD(p))
462 {
463 case 0x0000:
464 result->menuName = NULL;
465 p++;
466 break;
467 case 0xffff:
468 result->menuName = (LPCSTR)(UINT32)GET_WORD( p + 1 );
469 p += 2;
Alexandre Julliarda69b88b1998-03-15 20:29:56 +0000470 TRACE(dialog, " MENU %04x\n", LOWORD(result->menuName) );
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000471 break;
472 default:
473 result->menuName = (LPCSTR)p;
Alexandre Julliardc7c217b1998-04-13 12:21:30 +0000474 TRACE(dialog, " MENU %s\n", debugstr_w( (LPCWSTR)p ));
Alexandre Julliardd90840e1996-06-11 16:02:08 +0000475 p += lstrlen32W( (LPCWSTR)p ) + 1;
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000476 break;
Alexandre Julliardff8331e1995-09-18 11:19:54 +0000477 }
478
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000479 /* Get the class name */
Alexandre Julliard0e607781993-11-03 19:23:37 +0000480
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000481 switch(GET_WORD(p))
482 {
483 case 0x0000:
484 result->className = DIALOG_CLASS_ATOM;
485 p++;
486 break;
487 case 0xffff:
488 result->className = (LPCSTR)(UINT32)GET_WORD( p + 1 );
489 p += 2;
Alexandre Julliarda69b88b1998-03-15 20:29:56 +0000490 TRACE(dialog, " CLASS %04x\n", LOWORD(result->className) );
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000491 break;
492 default:
493 result->className = (LPCSTR)p;
Alexandre Julliardc7c217b1998-04-13 12:21:30 +0000494 TRACE(dialog, " CLASS %s\n", debugstr_w( (LPCWSTR)p ));
Alexandre Julliardd90840e1996-06-11 16:02:08 +0000495 p += lstrlen32W( (LPCWSTR)p ) + 1;
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000496 break;
497 }
Alexandre Julliard0e607781993-11-03 19:23:37 +0000498
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000499 /* Get the window caption */
Alexandre Julliardff8331e1995-09-18 11:19:54 +0000500
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000501 result->caption = (LPCSTR)p;
Alexandre Julliardd90840e1996-06-11 16:02:08 +0000502 p += lstrlen32W( (LPCWSTR)p ) + 1;
Alexandre Julliardc7c217b1998-04-13 12:21:30 +0000503 TRACE(dialog, " CAPTION %s\n", debugstr_w( (LPCWSTR)result->caption ) );
Alexandre Julliardff8331e1995-09-18 11:19:54 +0000504
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000505 /* Get the font name */
Alexandre Julliardff8331e1995-09-18 11:19:54 +0000506
Alexandre Julliard329f0681996-04-14 13:21:20 +0000507 if (result->style & DS_SETFONT)
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000508 {
509 result->pointSize = GET_WORD(p);
510 p++;
Alexandre Julliardc7c217b1998-04-13 12:21:30 +0000511 if (result->dialogEx)
512 {
513 result->weight = GET_WORD(p); p++;
514 result->italic = LOBYTE(GET_WORD(p)); p++;
515 }
516 else
517 {
518 result->weight = FW_DONTCARE;
519 result->italic = FALSE;
520 }
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000521 result->faceName = (LPCSTR)p;
Alexandre Julliardd90840e1996-06-11 16:02:08 +0000522 p += lstrlen32W( (LPCWSTR)p ) + 1;
Alexandre Julliardc7c217b1998-04-13 12:21:30 +0000523 TRACE(dialog, " FONT %d, %s, %d, %s\n",
524 result->pointSize, debugstr_w( (LPCWSTR)result->faceName ),
525 result->weight, result->italic ? "TRUE" : "FALSE" );
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000526 }
Alexandre Julliardc7c217b1998-04-13 12:21:30 +0000527
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000528 /* First control is on dword boundary */
529 return (LPCSTR)((((int)p) + 3) & ~3);
Alexandre Julliard0e607781993-11-03 19:23:37 +0000530}
Alexandre Julliard0e607781993-11-03 19:23:37 +0000531
532
533/***********************************************************************
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000534 * DIALOG_CreateIndirect
Alexandre Julliard0e607781993-11-03 19:23:37 +0000535 */
Alexandre Julliard9ea19e51997-01-01 17:29:55 +0000536HWND32 DIALOG_CreateIndirect( HINSTANCE32 hInst, LPCSTR dlgTemplate,
537 BOOL32 win32Template, HWND32 owner,
538 DLGPROC16 dlgProc, LPARAM param,
539 WINDOWPROCTYPE procType )
Alexandre Julliard0e607781993-11-03 19:23:37 +0000540{
Alexandre Julliardbf9130a1996-10-13 17:45:47 +0000541 HMENU16 hMenu = 0;
542 HFONT16 hFont = 0;
Alexandre Julliard01d63461997-01-20 19:43:45 +0000543 HWND32 hwnd;
544 RECT32 rect;
Alexandre Julliard0e607781993-11-03 19:23:37 +0000545 WND * wndPtr;
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000546 DLG_TEMPLATE template;
Alexandre Julliard0e607781993-11-03 19:23:37 +0000547 DIALOGINFO * dlgInfo;
548 WORD xUnit = xBaseUnit;
549 WORD yUnit = yBaseUnit;
Alexandre Julliard0e607781993-11-03 19:23:37 +0000550
Alexandre Julliarde399fc31993-11-24 17:08:56 +0000551 /* Parse dialog template */
552
553 if (!dlgTemplate) return 0;
Alexandre Julliard9ea19e51997-01-01 17:29:55 +0000554 if (win32Template)
Alexandre Julliard3051b641996-07-05 17:14:13 +0000555 dlgTemplate = DIALOG_ParseTemplate32( dlgTemplate, &template );
556 else
557 dlgTemplate = DIALOG_ParseTemplate16( dlgTemplate, &template );
Alexandre Julliard0e607781993-11-03 19:23:37 +0000558
559 /* Load menu */
560
Alexandre Julliard491502b1997-11-01 19:08:16 +0000561 if (template.menuName)
562 {
563 if (!win32Template)
Alexandre Julliard77b99181997-09-14 17:17:23 +0000564 {
565 LPSTR str = SEGPTR_STRDUP( template.menuName );
566 hMenu = LoadMenu16( hInst, SEGPTR_GET(str) );
567 SEGPTR_FREE( str );
Alexandre Julliard491502b1997-11-01 19:08:16 +0000568 }
569 else hMenu = LoadMenu32W( hInst, (LPCWSTR)template.menuName );
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000570 }
Alexandre Julliard0e607781993-11-03 19:23:37 +0000571
572 /* Create custom font if needed */
573
Alexandre Julliard329f0681996-04-14 13:21:20 +0000574 if (template.style & DS_SETFONT)
Alexandre Julliard0e607781993-11-03 19:23:37 +0000575 {
Alexandre Julliard3ed37e01994-11-07 18:20:42 +0000576 /* The font height must be negative as it is a point size */
577 /* (see CreateFont() documentation in the Windows SDK). */
Alexandre Julliardf90efa91998-06-14 15:24:15 +0000578
Alexandre Julliard3db94ef1997-09-28 17:43:24 +0000579 if (win32Template)
Alexandre Julliardc7c217b1998-04-13 12:21:30 +0000580 hFont = CreateFont32W( -template.pointSize, 0, 0, 0,
581 template.weight, template.italic, FALSE,
582 FALSE, DEFAULT_CHARSET, 0, 0, PROOF_QUALITY,
583 FF_DONTCARE, (LPCWSTR)template.faceName );
Alexandre Julliard3db94ef1997-09-28 17:43:24 +0000584 else
Alexandre Julliard491502b1997-11-01 19:08:16 +0000585 hFont = CreateFont16( -template.pointSize, 0, 0, 0, FW_DONTCARE,
Alexandre Julliardf90efa91998-06-14 15:24:15 +0000586 FALSE, FALSE, FALSE, DEFAULT_CHARSET, 0, 0,
587 PROOF_QUALITY, FF_DONTCARE,
588 template.faceName );
Alexandre Julliard0e607781993-11-03 19:23:37 +0000589 if (hFont)
590 {
Alexandre Julliardd90840e1996-06-11 16:02:08 +0000591 TEXTMETRIC16 tm;
Alexandre Julliardbf9130a1996-10-13 17:45:47 +0000592 HFONT16 oldFont;
Alexandre Julliard0e607781993-11-03 19:23:37 +0000593
Alexandre Julliard2c69f6d1996-09-28 18:11:01 +0000594 HDC32 hdc = GetDC32(0);
Alexandre Julliard139a4b11996-11-02 14:24:07 +0000595 oldFont = SelectObject32( hdc, hFont );
Alexandre Julliard3051b641996-07-05 17:14:13 +0000596 GetTextMetrics16( hdc, &tm );
Alexandre Julliard139a4b11996-11-02 14:24:07 +0000597 SelectObject32( hdc, oldFont );
Alexandre Julliard2c69f6d1996-09-28 18:11:01 +0000598 ReleaseDC32( 0, hdc );
Alexandre Julliard0e607781993-11-03 19:23:37 +0000599 xUnit = tm.tmAveCharWidth;
600 yUnit = tm.tmHeight;
Alexandre Julliardb1bac321996-12-15 19:45:59 +0000601 if (!(tm.tmPitchAndFamily & TMPF_FIXED_PITCH))
Alexandre Julliard7cbe6571995-01-09 18:21:16 +0000602 xBaseUnit = xBaseUnit * 5 / 4; /* See DIALOG_Init() */
Alexandre Julliard0e607781993-11-03 19:23:37 +0000603 }
604 }
Alexandre Julliarde399fc31993-11-24 17:08:56 +0000605
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000606 /* Create dialog main window */
Alexandre Julliard0e607781993-11-03 19:23:37 +0000607
Alexandre Julliardcdd09231994-01-12 11:12:51 +0000608 rect.left = rect.top = 0;
Alexandre Julliard329f0681996-04-14 13:21:20 +0000609 rect.right = template.cx * xUnit / 4;
610 rect.bottom = template.cy * yUnit / 8;
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000611 if (template.style & DS_MODALFRAME)
612 template.exStyle |= WS_EX_DLGMODALFRAME;
Alexandre Julliard01d63461997-01-20 19:43:45 +0000613 AdjustWindowRectEx32( &rect, template.style,
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000614 hMenu ? TRUE : FALSE , template.exStyle );
Alexandre Julliardff8331e1995-09-18 11:19:54 +0000615 rect.right -= rect.left;
616 rect.bottom -= rect.top;
Alexandre Julliardcdd09231994-01-12 11:12:51 +0000617
Alexandre Julliard1285c2f1996-05-06 16:06:24 +0000618 if ((INT16)template.x == CW_USEDEFAULT16)
Alexandre Julliardca22b331996-07-12 19:02:39 +0000619 {
620 rect.left = rect.top = (procType == WIN_PROC_16) ? CW_USEDEFAULT16
621 : CW_USEDEFAULT32;
622 }
Alexandre Julliardff8331e1995-09-18 11:19:54 +0000623 else
624 {
Alexandre Julliard329f0681996-04-14 13:21:20 +0000625 rect.left += template.x * xUnit / 4;
626 rect.top += template.y * yUnit / 8;
Alexandre Julliardda0cfb31996-12-01 17:17:47 +0000627 if ( !(template.style & WS_CHILD) )
628 {
629 INT16 dX, dY;
630
631 if( !(template.style & DS_ABSALIGN) )
Alexandre Julliard01d63461997-01-20 19:43:45 +0000632 ClientToScreen32( owner, (POINT32 *)&rect );
Alexandre Julliardda0cfb31996-12-01 17:17:47 +0000633
634 /* try to fit it into the desktop */
635
636 if( (dX = rect.left + rect.right + SYSMETRICS_CXDLGFRAME
637 - SYSMETRICS_CXSCREEN) > 0 ) rect.left -= dX;
638 if( (dY = rect.top + rect.bottom + SYSMETRICS_CYDLGFRAME
639 - SYSMETRICS_CYSCREEN) > 0 ) rect.top -= dY;
640 if( rect.left < 0 ) rect.left = 0;
641 if( rect.top < 0 ) rect.top = 0;
642 }
Alexandre Julliardff8331e1995-09-18 11:19:54 +0000643 }
644
Alexandre Julliard3db94ef1997-09-28 17:43:24 +0000645 if (procType == WIN_PROC_16)
646 hwnd = CreateWindowEx16(template.exStyle, template.className,
647 template.caption, template.style & ~WS_VISIBLE,
648 rect.left, rect.top, rect.right, rect.bottom,
649 owner, hMenu, hInst, NULL );
650 else
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000651 hwnd = CreateWindowEx32W(template.exStyle, (LPCWSTR)template.className,
652 (LPCWSTR)template.caption,
653 template.style & ~WS_VISIBLE,
654 rect.left, rect.top, rect.right, rect.bottom,
655 owner, hMenu, hInst, NULL );
Alexandre Julliard3db94ef1997-09-28 17:43:24 +0000656
Alexandre Julliard0e607781993-11-03 19:23:37 +0000657 if (!hwnd)
658 {
Alexandre Julliard139a4b11996-11-02 14:24:07 +0000659 if (hFont) DeleteObject32( hFont );
Alexandre Julliardc6c09441997-01-12 18:32:19 +0000660 if (hMenu) DestroyMenu32( hMenu );
Alexandre Julliard0e607781993-11-03 19:23:37 +0000661 return 0;
662 }
Alexandre Julliard902da691995-11-05 14:39:02 +0000663 wndPtr = WIN_FindWndPtr( hwnd );
Alexandre Julliard3051b641996-07-05 17:14:13 +0000664 wndPtr->flags |= WIN_ISDIALOG;
Alexandre Julliardc7c217b1998-04-13 12:21:30 +0000665 wndPtr->helpContext = template.helpId;
Alexandre Julliard902da691995-11-05 14:39:02 +0000666
Alexandre Julliard0e607781993-11-03 19:23:37 +0000667 /* Initialise dialog extra data */
668
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000669 dlgInfo = (DIALOGINFO *)wndPtr->wExtra;
Alexandre Julliarddf2673b1997-03-29 17:20:20 +0000670 WINPROC_SetProc( &dlgInfo->dlgProc, dlgProc, procType, WIN_PROC_WINDOW );
Alexandre Julliard0e607781993-11-03 19:23:37 +0000671 dlgInfo->hUserFont = hFont;
672 dlgInfo->hMenu = hMenu;
673 dlgInfo->xBaseUnit = xUnit;
674 dlgInfo->yBaseUnit = yUnit;
Alexandre Julliarddf2673b1997-03-29 17:20:20 +0000675 dlgInfo->msgResult = 0;
Alexandre Julliard7e6ae4b1996-12-08 19:25:27 +0000676 dlgInfo->idResult = 0;
Alexandre Julliarddf2673b1997-03-29 17:20:20 +0000677 dlgInfo->flags = 0;
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000678 dlgInfo->hDialogHeap = 0;
679
Alexandre Julliardda0cfb31996-12-01 17:17:47 +0000680 if (dlgInfo->hUserFont)
681 SendMessage32A( hwnd, WM_SETFONT, (WPARAM32)dlgInfo->hUserFont, 0 );
682
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000683 /* Create controls */
684
Alexandre Julliardc7c217b1998-04-13 12:21:30 +0000685 if (DIALOG_CreateControls( wndPtr, dlgTemplate, &template,
686 hInst, win32Template ))
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000687 {
Alexandre Julliarddf2673b1997-03-29 17:20:20 +0000688 /* Send initialisation messages and set focus */
689
Alexandre Julliard77b99181997-09-14 17:17:23 +0000690 dlgInfo->hwndFocus = GetNextDlgTabItem32( hwnd, 0, FALSE );
691
692 if (SendMessage32A( hwnd, WM_INITDIALOG, (WPARAM32)dlgInfo->hwndFocus, param ))
693 SetFocus32( dlgInfo->hwndFocus );
694
695 if (template.style & WS_VISIBLE && !(wndPtr->dwStyle & WS_VISIBLE))
696 {
697 ShowWindow32( hwnd, SW_SHOWNORMAL ); /* SW_SHOW doesn't always work */
698 UpdateWindow32( hwnd );
699 }
700 return hwnd;
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000701 }
702
Alexandre Julliarddf2673b1997-03-29 17:20:20 +0000703 if( IsWindow32(hwnd) ) DestroyWindow32( hwnd );
704 return 0;
Alexandre Julliard0e607781993-11-03 19:23:37 +0000705}
706
707
708/***********************************************************************
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000709 * CreateDialog16 (USER.89)
710 */
Alexandre Julliard670cdc41997-08-24 16:00:30 +0000711HWND16 WINAPI CreateDialog16( HINSTANCE16 hInst, SEGPTR dlgTemplate,
712 HWND16 owner, DLGPROC16 dlgProc )
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000713{
714 return CreateDialogParam16( hInst, dlgTemplate, owner, dlgProc, 0 );
715}
716
717
718/***********************************************************************
719 * CreateDialogParam16 (USER.241)
720 */
Alexandre Julliard670cdc41997-08-24 16:00:30 +0000721HWND16 WINAPI CreateDialogParam16( HINSTANCE16 hInst, SEGPTR dlgTemplate,
722 HWND16 owner, DLGPROC16 dlgProc,
723 LPARAM param )
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000724{
725 HWND16 hwnd = 0;
Alexandre Julliard8cc3a5e1996-08-11 15:49:51 +0000726 HRSRC16 hRsrc;
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000727 HGLOBAL16 hmem;
728 LPCVOID data;
729
Alexandre Julliarda69b88b1998-03-15 20:29:56 +0000730 TRACE(dialog, "%04x,%08lx,%04x,%08lx,%ld\n",
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000731 hInst, (DWORD)dlgTemplate, owner, (DWORD)dlgProc, param );
732
Alexandre Julliardc7c217b1998-04-13 12:21:30 +0000733 if (!(hRsrc = FindResource16( hInst, dlgTemplate, RT_DIALOG16 ))) return 0;
Alexandre Julliard18f92e71996-07-17 20:02:21 +0000734 if (!(hmem = LoadResource16( hInst, hRsrc ))) return 0;
735 if (!(data = LockResource16( hmem ))) hwnd = 0;
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000736 else hwnd = CreateDialogIndirectParam16( hInst, data, owner,
737 dlgProc, param );
Alexandre Julliard18f92e71996-07-17 20:02:21 +0000738 FreeResource16( hmem );
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000739 return hwnd;
740}
741
742
743/***********************************************************************
Alexandre Julliardc7c217b1998-04-13 12:21:30 +0000744 * CreateDialogParam32A (USER32.73)
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000745 */
Alexandre Julliard670cdc41997-08-24 16:00:30 +0000746HWND32 WINAPI CreateDialogParam32A( HINSTANCE32 hInst, LPCSTR name,
747 HWND32 owner, DLGPROC32 dlgProc,
748 LPARAM param )
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000749{
750 if (HIWORD(name))
751 {
Alexandre Julliard7ebe1a41996-12-22 18:27:48 +0000752 LPWSTR str = HEAP_strdupAtoW( GetProcessHeap(), 0, name );
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000753 HWND32 hwnd = CreateDialogParam32W( hInst, str, owner, dlgProc, param);
Alexandre Julliard7ebe1a41996-12-22 18:27:48 +0000754 HeapFree( GetProcessHeap(), 0, str );
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000755 return hwnd;
756 }
757 return CreateDialogParam32W( hInst, (LPCWSTR)name, owner, dlgProc, param );
758}
759
760
761/***********************************************************************
Alexandre Julliardc7c217b1998-04-13 12:21:30 +0000762 * CreateDialogParam32W (USER32.74)
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000763 */
Alexandre Julliard670cdc41997-08-24 16:00:30 +0000764HWND32 WINAPI CreateDialogParam32W( HINSTANCE32 hInst, LPCWSTR name,
765 HWND32 owner, DLGPROC32 dlgProc,
766 LPARAM param )
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000767{
Alexandre Julliardc7c217b1998-04-13 12:21:30 +0000768 HANDLE32 hrsrc = FindResource32W( hInst, name, RT_DIALOG32W );
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000769 if (!hrsrc) return 0;
Alexandre Julliard18f92e71996-07-17 20:02:21 +0000770 return CreateDialogIndirectParam32W( hInst,
771 (LPVOID)LoadResource32(hInst, hrsrc),
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000772 owner, dlgProc, param );
773}
774
775
776/***********************************************************************
777 * CreateDialogIndirect16 (USER.219)
778 */
Alexandre Julliard670cdc41997-08-24 16:00:30 +0000779HWND16 WINAPI CreateDialogIndirect16( HINSTANCE16 hInst, LPCVOID dlgTemplate,
780 HWND16 owner, DLGPROC16 dlgProc )
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000781{
782 return CreateDialogIndirectParam16( hInst, dlgTemplate, owner, dlgProc, 0);
783}
784
785
786/***********************************************************************
787 * CreateDialogIndirectParam16 (USER.242)
788 */
Alexandre Julliard670cdc41997-08-24 16:00:30 +0000789HWND16 WINAPI CreateDialogIndirectParam16( HINSTANCE16 hInst,
790 LPCVOID dlgTemplate,
791 HWND16 owner, DLGPROC16 dlgProc,
792 LPARAM param )
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000793{
Alexandre Julliard9ea19e51997-01-01 17:29:55 +0000794 return DIALOG_CreateIndirect( hInst, dlgTemplate, FALSE, owner,
Alexandre Julliard3051b641996-07-05 17:14:13 +0000795 dlgProc, param, WIN_PROC_16 );
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000796}
797
798
799/***********************************************************************
800 * CreateDialogIndirectParam32A (USER32.69)
801 */
Alexandre Julliard670cdc41997-08-24 16:00:30 +0000802HWND32 WINAPI CreateDialogIndirectParam32A( HINSTANCE32 hInst,
803 LPCVOID dlgTemplate,
804 HWND32 owner, DLGPROC32 dlgProc,
805 LPARAM param )
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000806{
Alexandre Julliard9ea19e51997-01-01 17:29:55 +0000807 return DIALOG_CreateIndirect( hInst, dlgTemplate, TRUE, owner,
Alexandre Julliard3051b641996-07-05 17:14:13 +0000808 (DLGPROC16)dlgProc, param, WIN_PROC_32A );
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000809}
810
811
812/***********************************************************************
Alexandre Julliardc7c217b1998-04-13 12:21:30 +0000813 * CreateDialogIndirectParam32W (USER32.72)
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000814 */
Alexandre Julliard670cdc41997-08-24 16:00:30 +0000815HWND32 WINAPI CreateDialogIndirectParam32W( HINSTANCE32 hInst,
816 LPCVOID dlgTemplate,
817 HWND32 owner, DLGPROC32 dlgProc,
818 LPARAM param )
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000819{
Alexandre Julliard9ea19e51997-01-01 17:29:55 +0000820 return DIALOG_CreateIndirect( hInst, dlgTemplate, TRUE, owner,
Alexandre Julliard3051b641996-07-05 17:14:13 +0000821 (DLGPROC16)dlgProc, param, WIN_PROC_32W );
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000822}
823
824
825/***********************************************************************
Alexandre Julliarde399fc31993-11-24 17:08:56 +0000826 * DIALOG_DoDialogBox
Alexandre Julliard0e607781993-11-03 19:23:37 +0000827 */
Alexandre Julliard9ea19e51997-01-01 17:29:55 +0000828INT32 DIALOG_DoDialogBox( HWND32 hwnd, HWND32 owner )
Alexandre Julliard0e607781993-11-03 19:23:37 +0000829{
Alexandre Julliard0e607781993-11-03 19:23:37 +0000830 WND * wndPtr;
831 DIALOGINFO * dlgInfo;
Alexandre Julliard1e37a181996-08-18 16:21:52 +0000832 MSG16 msg;
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000833 INT32 retval;
Alexandre Julliard0e607781993-11-03 19:23:37 +0000834
Alexandre Julliardaca05781994-10-17 18:12:41 +0000835 /* Owner must be a top-level window */
Alexandre Julliarde2991ea1995-07-29 13:09:43 +0000836 owner = WIN_GetTopParent( owner );
Alexandre Julliarde399fc31993-11-24 17:08:56 +0000837 if (!(wndPtr = WIN_FindWndPtr( hwnd ))) return -1;
Alexandre Julliard0e607781993-11-03 19:23:37 +0000838 dlgInfo = (DIALOGINFO *)wndPtr->wExtra;
Alexandre Julliard01d63461997-01-20 19:43:45 +0000839 EnableWindow32( owner, FALSE );
840 ShowWindow32( hwnd, SW_SHOW );
Alexandre Julliarde399fc31993-11-24 17:08:56 +0000841
Alexandre Julliard1e37a181996-08-18 16:21:52 +0000842 while (MSG_InternalGetMessage(&msg, hwnd, owner, MSGF_DIALOGBOX, PM_REMOVE,
843 !(wndPtr->dwStyle & DS_NOIDLEMSG) ))
Alexandre Julliard0e607781993-11-03 19:23:37 +0000844 {
Alexandre Julliardf0cbfa01997-02-15 14:29:56 +0000845 if (!IsDialogMessage16( hwnd, &msg))
Alexandre Julliard0e607781993-11-03 19:23:37 +0000846 {
Alexandre Julliardf0cbfa01997-02-15 14:29:56 +0000847 TranslateMessage16( &msg );
848 DispatchMessage16( &msg );
Alexandre Julliard0e607781993-11-03 19:23:37 +0000849 }
Alexandre Julliarddf2673b1997-03-29 17:20:20 +0000850 if (dlgInfo->flags & DF_END) break;
Alexandre Julliard0e607781993-11-03 19:23:37 +0000851 }
Alexandre Julliard7e6ae4b1996-12-08 19:25:27 +0000852 retval = dlgInfo->idResult;
Alexandre Julliard01d63461997-01-20 19:43:45 +0000853 EnableWindow32( owner, TRUE );
854 DestroyWindow32( hwnd );
Alexandre Julliard0e607781993-11-03 19:23:37 +0000855 return retval;
856}
857
858
859/***********************************************************************
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000860 * DialogBox16 (USER.87)
Alexandre Julliarde399fc31993-11-24 17:08:56 +0000861 */
Alexandre Julliard670cdc41997-08-24 16:00:30 +0000862INT16 WINAPI DialogBox16( HINSTANCE16 hInst, SEGPTR dlgTemplate,
863 HWND16 owner, DLGPROC16 dlgProc )
Alexandre Julliarde399fc31993-11-24 17:08:56 +0000864{
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000865 return DialogBoxParam16( hInst, dlgTemplate, owner, dlgProc, 0 );
Alexandre Julliarde399fc31993-11-24 17:08:56 +0000866}
867
868
869/***********************************************************************
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000870 * DialogBoxParam16 (USER.239)
Alexandre Julliarde399fc31993-11-24 17:08:56 +0000871 */
Alexandre Julliard670cdc41997-08-24 16:00:30 +0000872INT16 WINAPI DialogBoxParam16( HINSTANCE16 hInst, SEGPTR template,
873 HWND16 owner, DLGPROC16 dlgProc, LPARAM param )
Alexandre Julliarde399fc31993-11-24 17:08:56 +0000874{
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000875 HWND16 hwnd = CreateDialogParam16( hInst, template, owner, dlgProc, param);
876 if (hwnd) return (INT16)DIALOG_DoDialogBox( hwnd, owner );
877 return -1;
878}
879
880
881/***********************************************************************
Alexandre Julliardc7c217b1998-04-13 12:21:30 +0000882 * DialogBoxParam32A (USER32.139)
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000883 */
Alexandre Julliard670cdc41997-08-24 16:00:30 +0000884INT32 WINAPI DialogBoxParam32A( HINSTANCE32 hInst, LPCSTR name,
885 HWND32 owner, DLGPROC32 dlgProc, LPARAM param )
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000886{
887 HWND32 hwnd = CreateDialogParam32A( hInst, name, owner, dlgProc, param );
Alexandre Julliard3f2abfa1994-08-16 15:43:11 +0000888 if (hwnd) return DIALOG_DoDialogBox( hwnd, owner );
Alexandre Julliarde399fc31993-11-24 17:08:56 +0000889 return -1;
890}
891
892
893/***********************************************************************
Alexandre Julliardc7c217b1998-04-13 12:21:30 +0000894 * DialogBoxParam32W (USER32.140)
Alexandre Julliarde399fc31993-11-24 17:08:56 +0000895 */
Alexandre Julliard670cdc41997-08-24 16:00:30 +0000896INT32 WINAPI DialogBoxParam32W( HINSTANCE32 hInst, LPCWSTR name,
897 HWND32 owner, DLGPROC32 dlgProc, LPARAM param )
Alexandre Julliarde399fc31993-11-24 17:08:56 +0000898{
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000899 HWND32 hwnd = CreateDialogParam32W( hInst, name, owner, dlgProc, param );
900 if (hwnd) return DIALOG_DoDialogBox( hwnd, owner );
901 return -1;
Alexandre Julliarde399fc31993-11-24 17:08:56 +0000902}
903
904
905/***********************************************************************
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000906 * DialogBoxIndirect16 (USER.218)
Alexandre Julliarde399fc31993-11-24 17:08:56 +0000907 */
Alexandre Julliard670cdc41997-08-24 16:00:30 +0000908INT16 WINAPI DialogBoxIndirect16( HINSTANCE16 hInst, HANDLE16 dlgTemplate,
909 HWND16 owner, DLGPROC16 dlgProc )
Alexandre Julliarde399fc31993-11-24 17:08:56 +0000910{
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000911 return DialogBoxIndirectParam16( hInst, dlgTemplate, owner, dlgProc, 0 );
912}
Alexandre Julliarde399fc31993-11-24 17:08:56 +0000913
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000914
915/***********************************************************************
916 * DialogBoxIndirectParam16 (USER.240)
917 */
Alexandre Julliard670cdc41997-08-24 16:00:30 +0000918INT16 WINAPI DialogBoxIndirectParam16( HINSTANCE16 hInst, HANDLE16 dlgTemplate,
919 HWND16 owner, DLGPROC16 dlgProc,
920 LPARAM param )
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000921{
922 HWND16 hwnd;
923 LPCVOID ptr;
924
925 if (!(ptr = GlobalLock16( dlgTemplate ))) return -1;
926 hwnd = CreateDialogIndirectParam16( hInst, ptr, owner, dlgProc, param );
Alexandre Julliard1285c2f1996-05-06 16:06:24 +0000927 GlobalUnlock16( dlgTemplate );
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000928 if (hwnd) return (INT16)DIALOG_DoDialogBox( hwnd, owner );
929 return -1;
930}
931
932
933/***********************************************************************
Alexandre Julliardc7c217b1998-04-13 12:21:30 +0000934 * DialogBoxIndirectParam32A (USER32.136)
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000935 */
Alexandre Julliard670cdc41997-08-24 16:00:30 +0000936INT32 WINAPI DialogBoxIndirectParam32A(HINSTANCE32 hInstance, LPCVOID template,
937 HWND32 owner, DLGPROC32 dlgProc,
938 LPARAM param )
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000939{
940 HWND32 hwnd = CreateDialogIndirectParam32A( hInstance, template,
941 owner, dlgProc, param );
Alexandre Julliard3f2abfa1994-08-16 15:43:11 +0000942 if (hwnd) return DIALOG_DoDialogBox( hwnd, owner );
Alexandre Julliarde399fc31993-11-24 17:08:56 +0000943 return -1;
944}
945
Alexandre Julliard7cbe6571995-01-09 18:21:16 +0000946
Alexandre Julliard3ed37e01994-11-07 18:20:42 +0000947/***********************************************************************
Alexandre Julliardc7c217b1998-04-13 12:21:30 +0000948 * DialogBoxIndirectParam32W (USER32.138)
Alexandre Julliard0e607781993-11-03 19:23:37 +0000949 */
Alexandre Julliard670cdc41997-08-24 16:00:30 +0000950INT32 WINAPI DialogBoxIndirectParam32W(HINSTANCE32 hInstance, LPCVOID template,
951 HWND32 owner, DLGPROC32 dlgProc,
952 LPARAM param )
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000953{
954 HWND32 hwnd = CreateDialogIndirectParam32W( hInstance, template,
955 owner, dlgProc, param );
956 if (hwnd) return DIALOG_DoDialogBox( hwnd, owner );
957 return -1;
958}
959
960
961/***********************************************************************
Alexandre Julliardf0cbfa01997-02-15 14:29:56 +0000962 * EndDialog16 (USER32.173)
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000963 */
Alexandre Julliard670cdc41997-08-24 16:00:30 +0000964BOOL16 WINAPI EndDialog16( HWND16 hwnd, INT16 retval )
Alexandre Julliardf0cbfa01997-02-15 14:29:56 +0000965{
966 return EndDialog32( hwnd, retval );
967}
968
969
970/***********************************************************************
Alexandre Julliardc7c217b1998-04-13 12:21:30 +0000971 * EndDialog32 (USER.88)
Alexandre Julliardf0cbfa01997-02-15 14:29:56 +0000972 */
Alexandre Julliard670cdc41997-08-24 16:00:30 +0000973BOOL32 WINAPI EndDialog32( HWND32 hwnd, INT32 retval )
Alexandre Julliard0e607781993-11-03 19:23:37 +0000974{
975 WND * wndPtr = WIN_FindWndPtr( hwnd );
976 DIALOGINFO * dlgInfo = (DIALOGINFO *)wndPtr->wExtra;
Alexandre Julliarddf2673b1997-03-29 17:20:20 +0000977
Alexandre Julliarda69b88b1998-03-15 20:29:56 +0000978 TRACE(dialog, "%04x %d\n", hwnd, retval );
Alexandre Julliarddf2673b1997-03-29 17:20:20 +0000979
980 if( dlgInfo )
981 {
982 dlgInfo->idResult = retval;
983 dlgInfo->flags |= DF_END;
984 }
Alexandre Julliard0c126c71996-02-18 18:44:41 +0000985 return TRUE;
Alexandre Julliard0e607781993-11-03 19:23:37 +0000986}
987
988
989/***********************************************************************
Alexandre Julliardf0cbfa01997-02-15 14:29:56 +0000990 * DIALOG_IsDialogMessage
Alexandre Julliard0e607781993-11-03 19:23:37 +0000991 */
Alexandre Julliardf0cbfa01997-02-15 14:29:56 +0000992static BOOL32 DIALOG_IsDialogMessage( HWND32 hwnd, HWND32 hwndDlg,
993 UINT32 message, WPARAM32 wParam,
994 LPARAM lParam, BOOL32 *translate,
995 BOOL32 *dispatch )
Alexandre Julliard0e607781993-11-03 19:23:37 +0000996{
Alexandre Julliardf0cbfa01997-02-15 14:29:56 +0000997 INT32 dlgCode;
Alexandre Julliardaca05781994-10-17 18:12:41 +0000998
Alexandre Julliardf0cbfa01997-02-15 14:29:56 +0000999 *translate = *dispatch = FALSE;
Alexandre Julliard0e607781993-11-03 19:23:37 +00001000
Alexandre Julliard641ee761997-08-04 16:34:36 +00001001 if (message == WM_PAINT)
1002 {
1003 /* Apparently, we have to handle this one as well */
1004 *dispatch = TRUE;
1005 return TRUE;
1006 }
1007
Alexandre Julliardaca05781994-10-17 18:12:41 +00001008 /* Only the key messages get special processing */
Alexandre Julliardf0cbfa01997-02-15 14:29:56 +00001009 if ((message != WM_KEYDOWN) &&
1010 (message != WM_SYSCHAR) &&
1011 (message != WM_CHAR))
Alexandre Julliard7cbe6571995-01-09 18:21:16 +00001012 return FALSE;
1013
Alexandre Julliardf0cbfa01997-02-15 14:29:56 +00001014 dlgCode = SendMessage32A( hwnd, WM_GETDLGCODE, 0, 0 );
Alexandre Julliard7cbe6571995-01-09 18:21:16 +00001015 if (dlgCode & DLGC_WANTMESSAGE)
Alexandre Julliard0e607781993-11-03 19:23:37 +00001016 {
Alexandre Julliard23946ad1997-06-16 17:43:53 +00001017 *translate = *dispatch = TRUE;
Alexandre Julliard7cbe6571995-01-09 18:21:16 +00001018 return TRUE;
Alexandre Julliard0e607781993-11-03 19:23:37 +00001019 }
Alexandre Julliardaca05781994-10-17 18:12:41 +00001020
Alexandre Julliardf0cbfa01997-02-15 14:29:56 +00001021 switch(message)
Alexandre Julliard0e607781993-11-03 19:23:37 +00001022 {
Alexandre Julliardaca05781994-10-17 18:12:41 +00001023 case WM_KEYDOWN:
1024 if (dlgCode & DLGC_WANTALLKEYS) break;
Alexandre Julliardf0cbfa01997-02-15 14:29:56 +00001025 switch(wParam)
Alexandre Julliardaca05781994-10-17 18:12:41 +00001026 {
1027 case VK_TAB:
1028 if (!(dlgCode & DLGC_WANTTAB))
1029 {
Alexandre Julliardf0cbfa01997-02-15 14:29:56 +00001030 SendMessage32A( hwndDlg, WM_NEXTDLGCTL,
1031 (GetKeyState32(VK_SHIFT) & 0x8000), 0 );
Alexandre Julliardaca05781994-10-17 18:12:41 +00001032 return TRUE;
1033 }
1034 break;
1035
1036 case VK_RIGHT:
1037 case VK_DOWN:
1038 if (!(dlgCode & DLGC_WANTARROWS))
1039 {
Alexandre Julliardbf9130a1996-10-13 17:45:47 +00001040 SetFocus32( GetNextDlgGroupItem32( hwndDlg, GetFocus32(),
1041 FALSE ) );
Alexandre Julliardaca05781994-10-17 18:12:41 +00001042 return TRUE;
1043 }
1044 break;
1045
1046 case VK_LEFT:
1047 case VK_UP:
1048 if (!(dlgCode & DLGC_WANTARROWS))
1049 {
Alexandre Julliardbf9130a1996-10-13 17:45:47 +00001050 SetFocus32( GetNextDlgGroupItem32( hwndDlg, GetFocus32(),
1051 TRUE ) );
Alexandre Julliardaca05781994-10-17 18:12:41 +00001052 return TRUE;
1053 }
1054 break;
1055
1056 case VK_ESCAPE:
Alexandre Julliardca22b331996-07-12 19:02:39 +00001057 SendMessage32A( hwndDlg, WM_COMMAND, IDCANCEL,
Alexandre Julliard01d63461997-01-20 19:43:45 +00001058 (LPARAM)GetDlgItem32( hwndDlg, IDCANCEL ) );
Alexandre Julliardaca05781994-10-17 18:12:41 +00001059 break;
1060
1061 case VK_RETURN:
1062 {
Alexandre Julliard2d93d001996-05-21 15:01:41 +00001063 DWORD dw = SendMessage16( hwndDlg, DM_GETDEFID, 0, 0 );
Alexandre Julliardaca05781994-10-17 18:12:41 +00001064 if (HIWORD(dw) == DC_HASDEFID)
Alexandre Julliard2d93d001996-05-21 15:01:41 +00001065 SendMessage32A( hwndDlg, WM_COMMAND,
1066 MAKEWPARAM( LOWORD(dw), BN_CLICKED ),
Alexandre Julliard01d63461997-01-20 19:43:45 +00001067 (LPARAM)GetDlgItem32(hwndDlg, LOWORD(dw)));
Alexandre Julliardaf0bae51995-10-03 17:06:08 +00001068 else
Alexandre Julliardca22b331996-07-12 19:02:39 +00001069 SendMessage32A( hwndDlg, WM_COMMAND, IDOK,
Alexandre Julliard01d63461997-01-20 19:43:45 +00001070 (LPARAM)GetDlgItem32( hwndDlg, IDOK ) );
Alexandre Julliardaca05781994-10-17 18:12:41 +00001071 }
1072 break;
Alexandre Julliardc981d0b1996-03-31 16:40:13 +00001073
Alexandre Julliardf0cbfa01997-02-15 14:29:56 +00001074 default:
1075 *translate = TRUE;
1076 break;
Alexandre Julliardaca05781994-10-17 18:12:41 +00001077 }
1078 break; /* case WM_KEYDOWN */
1079
1080
1081 case WM_CHAR:
1082 if (dlgCode & (DLGC_WANTALLKEYS | DLGC_WANTCHARS)) break;
1083 break;
1084
1085 case WM_SYSCHAR:
1086 if (dlgCode & DLGC_WANTALLKEYS) break;
1087 break;
Alexandre Julliard0e607781993-11-03 19:23:37 +00001088 }
Alexandre Julliardaca05781994-10-17 18:12:41 +00001089
Alexandre Julliardf0cbfa01997-02-15 14:29:56 +00001090 /* If we get here, the message has not been treated specially */
1091 /* and can be sent to its destination window. */
1092 *dispatch = TRUE;
Alexandre Julliard0e607781993-11-03 19:23:37 +00001093 return TRUE;
1094}
1095
1096
Alexandre Julliardf0cbfa01997-02-15 14:29:56 +00001097/***********************************************************************
1098 * IsDialogMessage16 (USER.90)
1099 */
Alexandre Julliard670cdc41997-08-24 16:00:30 +00001100BOOL16 WINAPI IsDialogMessage16( HWND16 hwndDlg, LPMSG16 msg )
Alexandre Julliardf0cbfa01997-02-15 14:29:56 +00001101{
1102 BOOL32 ret, translate, dispatch;
1103
1104 if ((hwndDlg != msg->hwnd) && !IsChild16( hwndDlg, msg->hwnd ))
1105 return FALSE;
1106
1107 ret = DIALOG_IsDialogMessage( msg->hwnd, hwndDlg, msg->message,
1108 msg->wParam, msg->lParam,
1109 &translate, &dispatch );
1110 if (translate) TranslateMessage16( msg );
1111 if (dispatch) DispatchMessage16( msg );
1112 return ret;
1113}
1114
1115
1116/***********************************************************************
Alexandre Julliardc7c217b1998-04-13 12:21:30 +00001117 * IsDialogMessage32A (USER32.342)
Alexandre Julliardf0cbfa01997-02-15 14:29:56 +00001118 */
Alexandre Julliard670cdc41997-08-24 16:00:30 +00001119BOOL32 WINAPI IsDialogMessage32A( HWND32 hwndDlg, LPMSG32 msg )
Alexandre Julliardf0cbfa01997-02-15 14:29:56 +00001120{
1121 BOOL32 ret, translate, dispatch;
1122
1123 if ((hwndDlg != msg->hwnd) && !IsChild32( hwndDlg, msg->hwnd ))
1124 return FALSE;
1125
1126 ret = DIALOG_IsDialogMessage( msg->hwnd, hwndDlg, msg->message,
1127 msg->wParam, msg->lParam,
1128 &translate, &dispatch );
1129 if (translate) TranslateMessage32( msg );
1130 if (dispatch) DispatchMessage32A( msg );
1131 return ret;
1132}
1133
1134
1135/***********************************************************************
Alexandre Julliardc7c217b1998-04-13 12:21:30 +00001136 * IsDialogMessage32W (USER32.343)
Alexandre Julliardf0cbfa01997-02-15 14:29:56 +00001137 */
Alexandre Julliard670cdc41997-08-24 16:00:30 +00001138BOOL32 WINAPI IsDialogMessage32W( HWND32 hwndDlg, LPMSG32 msg )
Alexandre Julliardf0cbfa01997-02-15 14:29:56 +00001139{
1140 BOOL32 ret, translate, dispatch;
1141
1142 if ((hwndDlg != msg->hwnd) && !IsChild32( hwndDlg, msg->hwnd ))
1143 return FALSE;
1144
1145 ret = DIALOG_IsDialogMessage( msg->hwnd, hwndDlg, msg->message,
1146 msg->wParam, msg->lParam,
1147 &translate, &dispatch );
1148 if (translate) TranslateMessage32( msg );
1149 if (dispatch) DispatchMessage32W( msg );
1150 return ret;
1151}
1152
1153
Alexandre Julliard0e607781993-11-03 19:23:37 +00001154/****************************************************************
Alexandre Julliard01d63461997-01-20 19:43:45 +00001155 * GetDlgCtrlID16 (USER.277)
Alexandre Julliard0e607781993-11-03 19:23:37 +00001156 */
Alexandre Julliard670cdc41997-08-24 16:00:30 +00001157INT16 WINAPI GetDlgCtrlID16( HWND16 hwnd )
Alexandre Julliard01d63461997-01-20 19:43:45 +00001158{
1159 WND *wndPtr = WIN_FindWndPtr(hwnd);
1160 if (wndPtr) return wndPtr->wIDmenu;
1161 else return 0;
1162}
1163
1164
1165/****************************************************************
Alexandre Julliardc7c217b1998-04-13 12:21:30 +00001166 * GetDlgCtrlID32 (USER32.234)
Alexandre Julliard01d63461997-01-20 19:43:45 +00001167 */
Alexandre Julliard670cdc41997-08-24 16:00:30 +00001168INT32 WINAPI GetDlgCtrlID32( HWND32 hwnd )
Alexandre Julliard0e607781993-11-03 19:23:37 +00001169{
1170 WND *wndPtr = WIN_FindWndPtr(hwnd);
1171 if (wndPtr) return wndPtr->wIDmenu;
1172 else return 0;
1173}
1174
1175
1176/***********************************************************************
Alexandre Julliard01d63461997-01-20 19:43:45 +00001177 * GetDlgItem16 (USER.91)
Alexandre Julliard0e607781993-11-03 19:23:37 +00001178 */
Alexandre Julliard670cdc41997-08-24 16:00:30 +00001179HWND16 WINAPI GetDlgItem16( HWND16 hwndDlg, INT16 id )
Alexandre Julliard0e607781993-11-03 19:23:37 +00001180{
Alexandre Julliard59730ae1996-03-24 16:20:51 +00001181 WND *pWnd;
Alexandre Julliard0e607781993-11-03 19:23:37 +00001182
Alexandre Julliard59730ae1996-03-24 16:20:51 +00001183 if (!(pWnd = WIN_FindWndPtr( hwndDlg ))) return 0;
1184 for (pWnd = pWnd->child; pWnd; pWnd = pWnd->next)
Alexandre Julliard01d63461997-01-20 19:43:45 +00001185 if (pWnd->wIDmenu == (UINT16)id) return pWnd->hwndSelf;
1186 return 0;
1187}
1188
1189
1190/***********************************************************************
Alexandre Julliardc7c217b1998-04-13 12:21:30 +00001191 * GetDlgItem32 (USER32.235)
Alexandre Julliard01d63461997-01-20 19:43:45 +00001192 */
Alexandre Julliard670cdc41997-08-24 16:00:30 +00001193HWND32 WINAPI GetDlgItem32( HWND32 hwndDlg, INT32 id )
Alexandre Julliard01d63461997-01-20 19:43:45 +00001194{
1195 WND *pWnd;
1196
1197 if (!(pWnd = WIN_FindWndPtr( hwndDlg ))) return 0;
1198 for (pWnd = pWnd->child; pWnd; pWnd = pWnd->next)
1199 if (pWnd->wIDmenu == (UINT16)id) return pWnd->hwndSelf;
Alexandre Julliard0e607781993-11-03 19:23:37 +00001200 return 0;
1201}
1202
1203
1204/*******************************************************************
Alexandre Julliard2d93d001996-05-21 15:01:41 +00001205 * SendDlgItemMessage16 (USER.101)
Alexandre Julliard0e607781993-11-03 19:23:37 +00001206 */
Alexandre Julliard670cdc41997-08-24 16:00:30 +00001207LRESULT WINAPI SendDlgItemMessage16( HWND16 hwnd, INT16 id, UINT16 msg,
1208 WPARAM16 wParam, LPARAM lParam )
Alexandre Julliard0e607781993-11-03 19:23:37 +00001209{
Alexandre Julliard01d63461997-01-20 19:43:45 +00001210 HWND16 hwndCtrl = GetDlgItem16( hwnd, id );
Alexandre Julliard2d93d001996-05-21 15:01:41 +00001211 if (hwndCtrl) return SendMessage16( hwndCtrl, msg, wParam, lParam );
Alexandre Julliard0e607781993-11-03 19:23:37 +00001212 else return 0;
1213}
1214
1215
1216/*******************************************************************
Alexandre Julliardc7c217b1998-04-13 12:21:30 +00001217 * SendDlgItemMessage32A (USER32.452)
Alexandre Julliard0e607781993-11-03 19:23:37 +00001218 */
Alexandre Julliard670cdc41997-08-24 16:00:30 +00001219LRESULT WINAPI SendDlgItemMessage32A( HWND32 hwnd, INT32 id, UINT32 msg,
1220 WPARAM32 wParam, LPARAM lParam )
Alexandre Julliard0e607781993-11-03 19:23:37 +00001221{
Alexandre Julliard01d63461997-01-20 19:43:45 +00001222 HWND32 hwndCtrl = GetDlgItem32( hwnd, id );
Alexandre Julliard2d93d001996-05-21 15:01:41 +00001223 if (hwndCtrl) return SendMessage32A( hwndCtrl, msg, wParam, lParam );
1224 else return 0;
Alexandre Julliard0e607781993-11-03 19:23:37 +00001225}
1226
1227
1228/*******************************************************************
Alexandre Julliardc7c217b1998-04-13 12:21:30 +00001229 * SendDlgItemMessage32W (USER32.453)
Alexandre Julliard0e607781993-11-03 19:23:37 +00001230 */
Alexandre Julliard670cdc41997-08-24 16:00:30 +00001231LRESULT WINAPI SendDlgItemMessage32W( HWND32 hwnd, INT32 id, UINT32 msg,
1232 WPARAM32 wParam, LPARAM lParam )
Alexandre Julliard2d93d001996-05-21 15:01:41 +00001233{
Alexandre Julliard01d63461997-01-20 19:43:45 +00001234 HWND32 hwndCtrl = GetDlgItem32( hwnd, id );
Alexandre Julliard2d93d001996-05-21 15:01:41 +00001235 if (hwndCtrl) return SendMessage32W( hwndCtrl, msg, wParam, lParam );
1236 else return 0;
1237}
1238
1239
1240/*******************************************************************
1241 * SetDlgItemText16 (USER.92)
1242 */
Alexandre Julliard670cdc41997-08-24 16:00:30 +00001243void WINAPI SetDlgItemText16( HWND16 hwnd, INT16 id, SEGPTR lpString )
Alexandre Julliard2d93d001996-05-21 15:01:41 +00001244{
1245 SendDlgItemMessage16( hwnd, id, WM_SETTEXT, 0, (LPARAM)lpString );
1246}
1247
1248
1249/*******************************************************************
Alexandre Julliardc7c217b1998-04-13 12:21:30 +00001250 * SetDlgItemText32A (USER32.478)
Alexandre Julliard2d93d001996-05-21 15:01:41 +00001251 */
Alexandre Julliard670cdc41997-08-24 16:00:30 +00001252void WINAPI SetDlgItemText32A( HWND32 hwnd, INT32 id, LPCSTR lpString )
Alexandre Julliard2d93d001996-05-21 15:01:41 +00001253{
1254 SendDlgItemMessage32A( hwnd, id, WM_SETTEXT, 0, (LPARAM)lpString );
1255}
1256
1257
1258/*******************************************************************
Alexandre Julliardc7c217b1998-04-13 12:21:30 +00001259 * SetDlgItemText32W (USER32.479)
Alexandre Julliard2d93d001996-05-21 15:01:41 +00001260 */
Alexandre Julliard670cdc41997-08-24 16:00:30 +00001261void WINAPI SetDlgItemText32W( HWND32 hwnd, INT32 id, LPCWSTR lpString )
Alexandre Julliard2d93d001996-05-21 15:01:41 +00001262{
1263 SendDlgItemMessage32W( hwnd, id, WM_SETTEXT, 0, (LPARAM)lpString );
1264}
1265
1266
1267/***********************************************************************
1268 * GetDlgItemText16 (USER.93)
1269 */
Alexandre Julliard670cdc41997-08-24 16:00:30 +00001270INT16 WINAPI GetDlgItemText16( HWND16 hwnd, INT16 id, SEGPTR str, UINT16 len )
Alexandre Julliard2d93d001996-05-21 15:01:41 +00001271{
1272 return (INT16)SendDlgItemMessage16( hwnd, id, WM_GETTEXT,
1273 len, (LPARAM)str );
1274}
1275
1276
1277/***********************************************************************
Alexandre Julliardc7c217b1998-04-13 12:21:30 +00001278 * GetDlgItemText32A (USER32.237)
Alexandre Julliard2d93d001996-05-21 15:01:41 +00001279 */
Alexandre Julliard670cdc41997-08-24 16:00:30 +00001280INT32 WINAPI GetDlgItemText32A( HWND32 hwnd, INT32 id, LPSTR str, UINT32 len )
Alexandre Julliard2d93d001996-05-21 15:01:41 +00001281{
1282 return (INT32)SendDlgItemMessage32A( hwnd, id, WM_GETTEXT,
1283 len, (LPARAM)str );
1284}
1285
1286
1287/***********************************************************************
Alexandre Julliardc7c217b1998-04-13 12:21:30 +00001288 * GetDlgItemText32W (USER32.238)
Alexandre Julliard2d93d001996-05-21 15:01:41 +00001289 */
Alexandre Julliard670cdc41997-08-24 16:00:30 +00001290INT32 WINAPI GetDlgItemText32W( HWND32 hwnd, INT32 id, LPWSTR str, UINT32 len )
Alexandre Julliard2d93d001996-05-21 15:01:41 +00001291{
1292 return (INT32)SendDlgItemMessage32W( hwnd, id, WM_GETTEXT,
1293 len, (LPARAM)str );
1294}
1295
1296
1297/*******************************************************************
1298 * SetDlgItemInt16 (USER.94)
1299 */
Alexandre Julliard670cdc41997-08-24 16:00:30 +00001300void WINAPI SetDlgItemInt16( HWND16 hwnd, INT16 id, UINT16 value, BOOL16 fSigned )
Alexandre Julliard0e607781993-11-03 19:23:37 +00001301{
Alexandre Julliard01d63461997-01-20 19:43:45 +00001302 return SetDlgItemInt32( hwnd, (UINT32)(UINT16)id, value, fSigned );
Alexandre Julliard0e607781993-11-03 19:23:37 +00001303}
1304
1305
Alexandre Julliard2d93d001996-05-21 15:01:41 +00001306/*******************************************************************
Alexandre Julliardc7c217b1998-04-13 12:21:30 +00001307 * SetDlgItemInt32 (USER32.477)
Alexandre Julliard2d93d001996-05-21 15:01:41 +00001308 */
Alexandre Julliard670cdc41997-08-24 16:00:30 +00001309void WINAPI SetDlgItemInt32( HWND32 hwnd, INT32 id, UINT32 value,
1310 BOOL32 fSigned )
Alexandre Julliard2d93d001996-05-21 15:01:41 +00001311{
1312 char str[20];
1313
1314 if (fSigned) sprintf( str, "%d", (INT32)value );
1315 else sprintf( str, "%u", value );
1316 SendDlgItemMessage32A( hwnd, id, WM_SETTEXT, 0, (LPARAM)str );
1317}
1318
1319
Alexandre Julliard0e607781993-11-03 19:23:37 +00001320/***********************************************************************
Alexandre Julliard01d63461997-01-20 19:43:45 +00001321 * GetDlgItemInt16 (USER.95)
Alexandre Julliard0e607781993-11-03 19:23:37 +00001322 */
Alexandre Julliard670cdc41997-08-24 16:00:30 +00001323UINT16 WINAPI GetDlgItemInt16( HWND16 hwnd, INT16 id, BOOL16 *translated,
1324 BOOL16 fSigned )
Alexandre Julliard0e607781993-11-03 19:23:37 +00001325{
Alexandre Julliard01d63461997-01-20 19:43:45 +00001326 UINT32 result;
1327 BOOL32 ok;
1328
Alexandre Julliard0e607781993-11-03 19:23:37 +00001329 if (translated) *translated = FALSE;
Alexandre Julliard01d63461997-01-20 19:43:45 +00001330 result = GetDlgItemInt32( hwnd, (UINT32)(UINT16)id, &ok, fSigned );
1331 if (!ok) return 0;
1332 if (fSigned)
Alexandre Julliard0e607781993-11-03 19:23:37 +00001333 {
Alexandre Julliard01d63461997-01-20 19:43:45 +00001334 if (((INT32)result < -32767) || ((INT32)result > 32767)) return 0;
Alexandre Julliard0e607781993-11-03 19:23:37 +00001335 }
Alexandre Julliard01d63461997-01-20 19:43:45 +00001336 else
1337 {
1338 if (result > 65535) return 0;
1339 }
1340 if (translated) *translated = TRUE;
1341 return (UINT16)result;
Alexandre Julliard0e607781993-11-03 19:23:37 +00001342}
1343
1344
1345/***********************************************************************
Alexandre Julliardc7c217b1998-04-13 12:21:30 +00001346 * GetDlgItemInt32 (USER32.236)
Alexandre Julliard0e607781993-11-03 19:23:37 +00001347 */
Alexandre Julliard670cdc41997-08-24 16:00:30 +00001348UINT32 WINAPI GetDlgItemInt32( HWND32 hwnd, INT32 id, BOOL32 *translated,
1349 BOOL32 fSigned )
Alexandre Julliard01d63461997-01-20 19:43:45 +00001350{
1351 char str[30];
1352 char * endptr;
1353 long result = 0;
1354
1355 if (translated) *translated = FALSE;
1356 if (!SendDlgItemMessage32A(hwnd, id, WM_GETTEXT, sizeof(str), (LPARAM)str))
1357 return 0;
1358 if (fSigned)
1359 {
1360 result = strtol( str, &endptr, 10 );
1361 if (!endptr || (endptr == str)) /* Conversion was unsuccessful */
1362 return 0;
1363 if (((result == LONG_MIN) || (result == LONG_MAX)) && (errno==ERANGE))
1364 return 0;
1365 }
1366 else
1367 {
1368 result = strtoul( str, &endptr, 10 );
1369 if (!endptr || (endptr == str)) /* Conversion was unsuccessful */
1370 return 0;
1371 if ((result == ULONG_MAX) && (errno == ERANGE)) return 0;
1372 }
1373 if (translated) *translated = TRUE;
1374 return (UINT32)result;
1375}
1376
1377
1378/***********************************************************************
1379 * CheckDlgButton16 (USER.97)
1380 */
Alexandre Julliard670cdc41997-08-24 16:00:30 +00001381BOOL16 WINAPI CheckDlgButton16( HWND16 hwnd, INT16 id, UINT16 check )
Alexandre Julliard0e607781993-11-03 19:23:37 +00001382{
Alexandre Julliard2d93d001996-05-21 15:01:41 +00001383 SendDlgItemMessage32A( hwnd, id, BM_SETCHECK32, check, 0 );
Alexandre Julliard7e56f681996-01-31 19:02:28 +00001384 return TRUE;
Alexandre Julliard0e607781993-11-03 19:23:37 +00001385}
1386
1387
1388/***********************************************************************
Alexandre Julliardc7c217b1998-04-13 12:21:30 +00001389 * CheckDlgButton32 (USER32.45)
Alexandre Julliard0e607781993-11-03 19:23:37 +00001390 */
Alexandre Julliard670cdc41997-08-24 16:00:30 +00001391BOOL32 WINAPI CheckDlgButton32( HWND32 hwnd, INT32 id, UINT32 check )
Alexandre Julliard0e607781993-11-03 19:23:37 +00001392{
Alexandre Julliard01d63461997-01-20 19:43:45 +00001393 SendDlgItemMessage32A( hwnd, id, BM_SETCHECK32, check, 0 );
1394 return TRUE;
Alexandre Julliard0e607781993-11-03 19:23:37 +00001395}
1396
1397
1398/***********************************************************************
Alexandre Julliard01d63461997-01-20 19:43:45 +00001399 * IsDlgButtonChecked16 (USER.98)
Alexandre Julliard0e607781993-11-03 19:23:37 +00001400 */
Alexandre Julliard670cdc41997-08-24 16:00:30 +00001401UINT16 WINAPI IsDlgButtonChecked16( HWND16 hwnd, UINT16 id )
Alexandre Julliard01d63461997-01-20 19:43:45 +00001402{
1403 return (UINT16)SendDlgItemMessage32A( hwnd, id, BM_GETCHECK32, 0, 0 );
1404}
1405
1406
1407/***********************************************************************
Alexandre Julliardc7c217b1998-04-13 12:21:30 +00001408 * IsDlgButtonChecked32 (USER32.344)
Alexandre Julliard01d63461997-01-20 19:43:45 +00001409 */
Alexandre Julliard670cdc41997-08-24 16:00:30 +00001410UINT32 WINAPI IsDlgButtonChecked32( HWND32 hwnd, UINT32 id )
Alexandre Julliard01d63461997-01-20 19:43:45 +00001411{
1412 return (UINT32)SendDlgItemMessage32A( hwnd, id, BM_GETCHECK32, 0, 0 );
1413}
1414
1415
1416/***********************************************************************
1417 * CheckRadioButton16 (USER.96)
1418 */
Alexandre Julliard670cdc41997-08-24 16:00:30 +00001419BOOL16 WINAPI CheckRadioButton16( HWND16 hwndDlg, UINT16 firstID,
1420 UINT16 lastID, UINT16 checkID )
Alexandre Julliard01d63461997-01-20 19:43:45 +00001421{
1422 return CheckRadioButton32( hwndDlg, firstID, lastID, checkID );
1423}
1424
1425
1426/***********************************************************************
Alexandre Julliardc7c217b1998-04-13 12:21:30 +00001427 * CheckRadioButton32 (USER32.48)
Alexandre Julliard01d63461997-01-20 19:43:45 +00001428 */
Alexandre Julliard670cdc41997-08-24 16:00:30 +00001429BOOL32 WINAPI CheckRadioButton32( HWND32 hwndDlg, UINT32 firstID,
1430 UINT32 lastID, UINT32 checkID )
Alexandre Julliard0e607781993-11-03 19:23:37 +00001431{
Alexandre Julliard59730ae1996-03-24 16:20:51 +00001432 WND *pWnd = WIN_FindWndPtr( hwndDlg );
1433 if (!pWnd) return FALSE;
Alexandre Julliardecc37121994-11-22 16:31:29 +00001434
Alexandre Julliard59730ae1996-03-24 16:20:51 +00001435 for (pWnd = pWnd->child; pWnd; pWnd = pWnd->next)
1436 if ((pWnd->wIDmenu == firstID) || (pWnd->wIDmenu == lastID)) break;
1437 if (!pWnd) return FALSE;
Alexandre Julliardecc37121994-11-22 16:31:29 +00001438
Alexandre Julliard59730ae1996-03-24 16:20:51 +00001439 if (pWnd->wIDmenu == lastID)
Alexandre Julliardecc37121994-11-22 16:31:29 +00001440 lastID = firstID; /* Buttons are in reverse order */
Alexandre Julliard59730ae1996-03-24 16:20:51 +00001441 while (pWnd)
Alexandre Julliardecc37121994-11-22 16:31:29 +00001442 {
Alexandre Julliard2d93d001996-05-21 15:01:41 +00001443 SendMessage32A( pWnd->hwndSelf, BM_SETCHECK32,
1444 (pWnd->wIDmenu == checkID), 0 );
Alexandre Julliard59730ae1996-03-24 16:20:51 +00001445 if (pWnd->wIDmenu == lastID) break;
1446 pWnd = pWnd->next;
Alexandre Julliard0e607781993-11-03 19:23:37 +00001447 }
Alexandre Julliard7e56f681996-01-31 19:02:28 +00001448 return TRUE;
Alexandre Julliard0e607781993-11-03 19:23:37 +00001449}
1450
1451
1452/***********************************************************************
Alexandre Julliardc7c217b1998-04-13 12:21:30 +00001453 * GetDialogBaseUnits (USER.243) (USER32.233)
Alexandre Julliard0e607781993-11-03 19:23:37 +00001454 */
Alexandre Julliard670cdc41997-08-24 16:00:30 +00001455DWORD WINAPI GetDialogBaseUnits(void)
Alexandre Julliard0e607781993-11-03 19:23:37 +00001456{
1457 return MAKELONG( xBaseUnit, yBaseUnit );
1458}
1459
1460
1461/***********************************************************************
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +00001462 * MapDialogRect16 (USER.103)
Alexandre Julliard0e607781993-11-03 19:23:37 +00001463 */
Alexandre Julliard670cdc41997-08-24 16:00:30 +00001464void WINAPI MapDialogRect16( HWND16 hwnd, LPRECT16 rect )
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +00001465{
1466 DIALOGINFO * dlgInfo;
1467 WND * wndPtr = WIN_FindWndPtr( hwnd );
1468 if (!wndPtr) return;
1469 dlgInfo = (DIALOGINFO *)wndPtr->wExtra;
1470 rect->left = (rect->left * dlgInfo->xBaseUnit) / 4;
1471 rect->right = (rect->right * dlgInfo->xBaseUnit) / 4;
1472 rect->top = (rect->top * dlgInfo->yBaseUnit) / 8;
1473 rect->bottom = (rect->bottom * dlgInfo->yBaseUnit) / 8;
1474}
1475
1476
1477/***********************************************************************
Alexandre Julliardc7c217b1998-04-13 12:21:30 +00001478 * MapDialogRect32 (USER32.382)
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +00001479 */
Alexandre Julliard670cdc41997-08-24 16:00:30 +00001480void WINAPI MapDialogRect32( HWND32 hwnd, LPRECT32 rect )
Alexandre Julliard0e607781993-11-03 19:23:37 +00001481{
1482 DIALOGINFO * dlgInfo;
1483 WND * wndPtr = WIN_FindWndPtr( hwnd );
1484 if (!wndPtr) return;
1485 dlgInfo = (DIALOGINFO *)wndPtr->wExtra;
1486 rect->left = (rect->left * dlgInfo->xBaseUnit) / 4;
1487 rect->right = (rect->right * dlgInfo->xBaseUnit) / 4;
1488 rect->top = (rect->top * dlgInfo->yBaseUnit) / 8;
1489 rect->bottom = (rect->bottom * dlgInfo->yBaseUnit) / 8;
1490}
1491
1492
1493/***********************************************************************
Alexandre Julliardbf9130a1996-10-13 17:45:47 +00001494 * GetNextDlgGroupItem16 (USER.227)
Alexandre Julliard0e607781993-11-03 19:23:37 +00001495 */
Alexandre Julliard670cdc41997-08-24 16:00:30 +00001496HWND16 WINAPI GetNextDlgGroupItem16( HWND16 hwndDlg, HWND16 hwndCtrl,
1497 BOOL16 fPrevious )
Alexandre Julliard0e607781993-11-03 19:23:37 +00001498{
Alexandre Julliardbf9130a1996-10-13 17:45:47 +00001499 return (HWND16)GetNextDlgGroupItem32( hwndDlg, hwndCtrl, fPrevious );
Alexandre Julliard0e607781993-11-03 19:23:37 +00001500}
1501
1502
1503/***********************************************************************
Alexandre Julliardc7c217b1998-04-13 12:21:30 +00001504 * GetNextDlgGroupItem32 (USER32.275)
Alexandre Julliard0e607781993-11-03 19:23:37 +00001505 */
Alexandre Julliard670cdc41997-08-24 16:00:30 +00001506HWND32 WINAPI GetNextDlgGroupItem32( HWND32 hwndDlg, HWND32 hwndCtrl,
1507 BOOL32 fPrevious )
Alexandre Julliard0e607781993-11-03 19:23:37 +00001508{
Alexandre Julliard59730ae1996-03-24 16:20:51 +00001509 WND *pWnd, *pWndLast, *pWndCtrl, *pWndDlg;
Alexandre Julliard0e607781993-11-03 19:23:37 +00001510
Alexandre Julliard59730ae1996-03-24 16:20:51 +00001511 if (!(pWndDlg = WIN_FindWndPtr( hwndDlg ))) return 0;
Alexandre Julliardbf9130a1996-10-13 17:45:47 +00001512 if (hwndCtrl)
1513 {
1514 if (!(pWndCtrl = WIN_FindWndPtr( hwndCtrl ))) return 0;
1515 /* Make sure hwndCtrl is a top-level child */
1516 while ((pWndCtrl->dwStyle & WS_CHILD) && (pWndCtrl->parent != pWndDlg))
1517 pWndCtrl = pWndCtrl->parent;
1518 if (pWndCtrl->parent != pWndDlg) return 0;
1519 }
1520 else
1521 {
1522 /* No ctrl specified -> start from the beginning */
1523 if (!(pWndCtrl = pWndDlg->child)) return 0;
1524 if (fPrevious) while (pWndCtrl->next) pWndCtrl = pWndCtrl->next;
1525 }
1526
1527 pWndLast = pWndCtrl;
1528 pWnd = pWndCtrl->next;
1529 while (1)
1530 {
1531 if (!pWnd || (pWnd->dwStyle & WS_GROUP))
1532 {
1533 /* Wrap-around to the beginning of the group */
1534 WND *pWndStart = pWndDlg->child;
1535 for (pWnd = pWndStart; pWnd; pWnd = pWnd->next)
1536 {
1537 if (pWnd->dwStyle & WS_GROUP) pWndStart = pWnd;
1538 if (pWnd == pWndCtrl) break;
1539 }
1540 pWnd = pWndStart;
1541 }
1542 if (pWnd == pWndCtrl) break;
1543 if ((pWnd->dwStyle & WS_VISIBLE) && !(pWnd->dwStyle & WS_DISABLED))
1544 {
1545 pWndLast = pWnd;
1546 if (!fPrevious) break;
1547 }
1548 pWnd = pWnd->next;
1549 }
1550 return pWndLast->hwndSelf;
1551}
1552
1553
1554/***********************************************************************
1555 * GetNextDlgTabItem16 (USER.228)
1556 */
Alexandre Julliard670cdc41997-08-24 16:00:30 +00001557HWND16 WINAPI GetNextDlgTabItem16( HWND16 hwndDlg, HWND16 hwndCtrl,
1558 BOOL16 fPrevious )
Alexandre Julliardbf9130a1996-10-13 17:45:47 +00001559{
1560 return (HWND16)GetNextDlgTabItem32( hwndDlg, hwndCtrl, fPrevious );
1561}
1562
1563
1564/***********************************************************************
Alexandre Julliardc7c217b1998-04-13 12:21:30 +00001565 * GetNextDlgTabItem32 (USER32.276)
Alexandre Julliardbf9130a1996-10-13 17:45:47 +00001566 */
Alexandre Julliard670cdc41997-08-24 16:00:30 +00001567HWND32 WINAPI GetNextDlgTabItem32( HWND32 hwndDlg, HWND32 hwndCtrl,
1568 BOOL32 fPrevious )
Alexandre Julliardbf9130a1996-10-13 17:45:47 +00001569{
1570 WND *pWnd, *pWndLast, *pWndCtrl, *pWndDlg;
1571
1572 if (!(pWndDlg = WIN_FindWndPtr( hwndDlg ))) return 0;
1573 if (hwndCtrl)
1574 {
1575 if (!(pWndCtrl = WIN_FindWndPtr( hwndCtrl ))) return 0;
1576 /* Make sure hwndCtrl is a top-level child */
1577 while ((pWndCtrl->dwStyle & WS_CHILD) && (pWndCtrl->parent != pWndDlg))
1578 pWndCtrl = pWndCtrl->parent;
1579 if (pWndCtrl->parent != pWndDlg) return 0;
1580 }
1581 else
1582 {
1583 /* No ctrl specified -> start from the beginning */
1584 if (!(pWndCtrl = pWndDlg->child)) return 0;
Alexandre Julliarda0d77311998-09-13 16:32:00 +00001585 if (!fPrevious) while (pWndCtrl->next) pWndCtrl = pWndCtrl->next;
Alexandre Julliardbf9130a1996-10-13 17:45:47 +00001586 }
Alexandre Julliard0e607781993-11-03 19:23:37 +00001587
Alexandre Julliard59730ae1996-03-24 16:20:51 +00001588 pWndLast = pWndCtrl;
1589 pWnd = pWndCtrl->next;
Alexandre Julliard0e607781993-11-03 19:23:37 +00001590 while (1)
1591 {
Alexandre Julliard59730ae1996-03-24 16:20:51 +00001592 if (!pWnd) pWnd = pWndDlg->child;
1593 if (pWnd == pWndCtrl) break;
Alexandre Julliardbf9130a1996-10-13 17:45:47 +00001594 if ((pWnd->dwStyle & WS_TABSTOP) && (pWnd->dwStyle & WS_VISIBLE) &&
1595 !(pWnd->dwStyle & WS_DISABLED))
Alexandre Julliard0e607781993-11-03 19:23:37 +00001596 {
Alexandre Julliard59730ae1996-03-24 16:20:51 +00001597 pWndLast = pWnd;
Alexandre Julliard0e607781993-11-03 19:23:37 +00001598 if (!fPrevious) break;
1599 }
Alexandre Julliard59730ae1996-03-24 16:20:51 +00001600 pWnd = pWnd->next;
Alexandre Julliard0e607781993-11-03 19:23:37 +00001601 }
Alexandre Julliard59730ae1996-03-24 16:20:51 +00001602 return pWndLast->hwndSelf;
Alexandre Julliard0e607781993-11-03 19:23:37 +00001603}
Alexandre Julliard75d86e11996-11-17 18:59:11 +00001604
1605
1606/**********************************************************************
1607 * DIALOG_DlgDirSelect
1608 *
1609 * Helper function for DlgDirSelect*
1610 */
1611static BOOL32 DIALOG_DlgDirSelect( HWND32 hwnd, LPSTR str, INT32 len,
1612 INT32 id, BOOL32 win32, BOOL32 unicode,
1613 BOOL32 combo )
1614{
1615 char *buffer, *ptr;
1616 INT32 item, size;
1617 BOOL32 ret;
Alexandre Julliard01d63461997-01-20 19:43:45 +00001618 HWND32 listbox = GetDlgItem32( hwnd, id );
Alexandre Julliard75d86e11996-11-17 18:59:11 +00001619
Alexandre Julliarda69b88b1998-03-15 20:29:56 +00001620 TRACE(dialog, "%04x '%s' %d\n", hwnd, str, id );
Alexandre Julliard75d86e11996-11-17 18:59:11 +00001621 if (!listbox) return FALSE;
1622 if (win32)
1623 {
1624 item = SendMessage32A(listbox, combo ? CB_GETCURSEL32
1625 : LB_GETCURSEL32, 0, 0 );
1626 if (item == LB_ERR) return FALSE;
1627 size = SendMessage32A(listbox, combo ? CB_GETLBTEXTLEN32
1628 : LB_GETTEXTLEN32, 0, 0 );
1629 if (size == LB_ERR) return FALSE;
1630 }
1631 else
1632 {
1633 item = SendMessage32A(listbox, combo ? CB_GETCURSEL16
1634 : LB_GETCURSEL16, 0, 0 );
1635 if (item == LB_ERR) return FALSE;
1636 size = SendMessage32A(listbox, combo ? CB_GETLBTEXTLEN16
1637 : LB_GETTEXTLEN16, 0, 0 );
1638 if (size == LB_ERR) return FALSE;
1639 }
1640
1641 if (!(buffer = SEGPTR_ALLOC( size+1 ))) return FALSE;
1642
1643 if (win32)
1644 SendMessage32A( listbox, combo ? CB_GETLBTEXT32 : LB_GETTEXT32,
1645 item, (LPARAM)buffer );
1646 else
1647 SendMessage16( listbox, combo ? CB_GETLBTEXT16 : LB_GETTEXT16,
1648 item, (LPARAM)SEGPTR_GET(buffer) );
1649
1650 if ((ret = (buffer[0] == '['))) /* drive or directory */
1651 {
1652 if (buffer[1] == '-') /* drive */
1653 {
1654 buffer[3] = ':';
1655 buffer[4] = 0;
1656 ptr = buffer + 2;
1657 }
1658 else
1659 {
1660 buffer[strlen(buffer)-1] = '\\';
1661 ptr = buffer + 1;
1662 }
1663 }
1664 else ptr = buffer;
1665
1666 if (unicode) lstrcpynAtoW( (LPWSTR)str, ptr, len );
1667 else lstrcpyn32A( str, ptr, len );
1668 SEGPTR_FREE( buffer );
Alexandre Julliarda69b88b1998-03-15 20:29:56 +00001669 TRACE(dialog, "Returning %d '%s'\n", ret, str );
Alexandre Julliard75d86e11996-11-17 18:59:11 +00001670 return ret;
1671}
1672
1673
1674/**********************************************************************
Alexandre Julliardda0cfb31996-12-01 17:17:47 +00001675 * DIALOG_DlgDirList
1676 *
1677 * Helper function for DlgDirList*
1678 */
Alexandre Julliard84c70f51997-05-09 08:40:27 +00001679static INT32 DIALOG_DlgDirList( HWND32 hDlg, LPSTR spec, INT32 idLBox,
Alexandre Julliardda0cfb31996-12-01 17:17:47 +00001680 INT32 idStatic, UINT32 attrib, BOOL32 combo )
1681{
1682 int drive;
1683 HWND32 hwnd;
Alexandre Julliard84c70f51997-05-09 08:40:27 +00001684 LPSTR orig_spec = spec;
Alexandre Julliardda0cfb31996-12-01 17:17:47 +00001685
1686#define SENDMSG(msg,wparam,lparam) \
Alexandre Julliard21979011997-03-05 08:22:35 +00001687 ((attrib & DDL_POSTMSGS) ? PostMessage32A( hwnd, msg, wparam, lparam ) \
Alexandre Julliardda0cfb31996-12-01 17:17:47 +00001688 : SendMessage32A( hwnd, msg, wparam, lparam ))
1689
Alexandre Julliarda69b88b1998-03-15 20:29:56 +00001690 TRACE(dialog, "%04x '%s' %d %d %04x\n",
Alexandre Julliardda0cfb31996-12-01 17:17:47 +00001691 hDlg, spec ? spec : "NULL", idLBox, idStatic, attrib );
1692
1693 if (spec && spec[0] && (spec[1] == ':'))
1694 {
1695 drive = toupper( spec[0] ) - 'A';
1696 spec += 2;
1697 if (!DRIVE_SetCurrentDrive( drive )) return FALSE;
1698 }
1699 else drive = DRIVE_GetCurrentDrive();
1700
Alexandre Julliard84c70f51997-05-09 08:40:27 +00001701 /* If the path exists and is a directory, chdir to it */
1702 if (!spec || !spec[0] || DRIVE_Chdir( drive, spec )) spec = "*.*";
1703 else
1704 {
1705 char *p, *p2;
1706 p = spec;
1707 if ((p2 = strrchr( p, '\\' ))) p = p2;
1708 if ((p2 = strrchr( p, '/' ))) p = p2;
1709 if (p != spec)
1710 {
1711 char sep = *p;
1712 *p = 0;
1713 if (!DRIVE_Chdir( drive, spec ))
1714 {
1715 *p = sep; /* Restore the original spec */
1716 return FALSE;
1717 }
1718 spec = p + 1;
1719 }
1720 }
1721
Alexandre Julliarda69b88b1998-03-15 20:29:56 +00001722 TRACE(dialog, "path=%c:\\%s mask=%s\n",
Alexandre Julliard84c70f51997-05-09 08:40:27 +00001723 'A' + drive, DRIVE_GetDosCwd(drive), spec );
1724
Alexandre Julliard01d63461997-01-20 19:43:45 +00001725 if (idLBox && ((hwnd = GetDlgItem32( hDlg, idLBox )) != 0))
Alexandre Julliardda0cfb31996-12-01 17:17:47 +00001726 {
Alexandre Julliardda0cfb31996-12-01 17:17:47 +00001727 SENDMSG( combo ? CB_RESETCONTENT32 : LB_RESETCONTENT32, 0, 0 );
Alexandre Julliard84c70f51997-05-09 08:40:27 +00001728 if (attrib & DDL_DIRECTORY)
Alexandre Julliardda0cfb31996-12-01 17:17:47 +00001729 {
Alexandre Julliard84c70f51997-05-09 08:40:27 +00001730 if (!(attrib & DDL_EXCLUSIVE))
1731 {
1732 if (SENDMSG( combo ? CB_DIR32 : LB_DIR32,
1733 attrib & ~(DDL_DIRECTORY | DDL_DRIVES),
1734 (LPARAM)spec ) == LB_ERR)
1735 return FALSE;
1736 }
Alexandre Julliardda0cfb31996-12-01 17:17:47 +00001737 if (SENDMSG( combo ? CB_DIR32 : LB_DIR32,
1738 (attrib & (DDL_DIRECTORY | DDL_DRIVES)) | DDL_EXCLUSIVE,
1739 (LPARAM)"*.*" ) == LB_ERR)
1740 return FALSE;
1741 }
1742 else
1743 {
1744 if (SENDMSG( combo ? CB_DIR32 : LB_DIR32, attrib,
1745 (LPARAM)spec ) == LB_ERR)
1746 return FALSE;
1747 }
1748 }
1749
Alexandre Julliard01d63461997-01-20 19:43:45 +00001750 if (idStatic && ((hwnd = GetDlgItem32( hDlg, idStatic )) != 0))
Alexandre Julliardda0cfb31996-12-01 17:17:47 +00001751 {
1752 char temp[512];
1753 int drive = DRIVE_GetCurrentDrive();
1754 strcpy( temp, "A:\\" );
1755 temp[0] += drive;
1756 lstrcpyn32A( temp + 3, DRIVE_GetDosCwd(drive), sizeof(temp)-3 );
Alexandre Julliardc6c09441997-01-12 18:32:19 +00001757 CharLower32A( temp );
Alexandre Julliardda0cfb31996-12-01 17:17:47 +00001758 /* Can't use PostMessage() here, because the string is on the stack */
1759 SetDlgItemText32A( hDlg, idStatic, temp );
1760 }
Alexandre Julliard84c70f51997-05-09 08:40:27 +00001761
1762 if (orig_spec && (spec != orig_spec))
1763 {
1764 /* Update the original file spec */
1765 char *p = spec;
1766 while ((*orig_spec++ = *p++));
1767 }
1768
Alexandre Julliardda0cfb31996-12-01 17:17:47 +00001769 return TRUE;
1770#undef SENDMSG
1771}
1772
1773
1774/**********************************************************************
Alexandre Julliard84c70f51997-05-09 08:40:27 +00001775 * DIALOG_DlgDirListW
1776 *
1777 * Helper function for DlgDirList*32W
1778 */
1779static INT32 DIALOG_DlgDirListW( HWND32 hDlg, LPWSTR spec, INT32 idLBox,
1780 INT32 idStatic, UINT32 attrib, BOOL32 combo )
1781{
1782 if (spec)
1783 {
1784 LPSTR specA = HEAP_strdupWtoA( GetProcessHeap(), 0, spec );
1785 INT32 ret = DIALOG_DlgDirList( hDlg, specA, idLBox, idStatic,
1786 attrib, combo );
1787 lstrcpyAtoW( spec, specA );
1788 HeapFree( GetProcessHeap(), 0, specA );
1789 return ret;
1790 }
1791 return DIALOG_DlgDirList( hDlg, NULL, idLBox, idStatic, attrib, combo );
1792}
1793
1794
1795/**********************************************************************
Alexandre Julliard75d86e11996-11-17 18:59:11 +00001796 * DlgDirSelect (USER.99)
1797 */
Alexandre Julliard670cdc41997-08-24 16:00:30 +00001798BOOL16 WINAPI DlgDirSelect( HWND16 hwnd, LPSTR str, INT16 id )
Alexandre Julliard75d86e11996-11-17 18:59:11 +00001799{
1800 return DlgDirSelectEx16( hwnd, str, 128, id );
1801}
1802
1803
1804/**********************************************************************
1805 * DlgDirSelectComboBox (USER.194)
1806 */
Alexandre Julliard670cdc41997-08-24 16:00:30 +00001807BOOL16 WINAPI DlgDirSelectComboBox( HWND16 hwnd, LPSTR str, INT16 id )
Alexandre Julliard75d86e11996-11-17 18:59:11 +00001808{
1809 return DlgDirSelectComboBoxEx16( hwnd, str, 128, id );
1810}
1811
1812
1813/**********************************************************************
1814 * DlgDirSelectEx16 (USER.422)
1815 */
Alexandre Julliard670cdc41997-08-24 16:00:30 +00001816BOOL16 WINAPI DlgDirSelectEx16( HWND16 hwnd, LPSTR str, INT16 len, INT16 id )
Alexandre Julliard75d86e11996-11-17 18:59:11 +00001817{
1818 return DIALOG_DlgDirSelect( hwnd, str, len, id, FALSE, FALSE, FALSE );
1819}
1820
1821
1822/**********************************************************************
Alexandre Julliardc7c217b1998-04-13 12:21:30 +00001823 * DlgDirSelectEx32A (USER32.149)
Alexandre Julliard75d86e11996-11-17 18:59:11 +00001824 */
Alexandre Julliard670cdc41997-08-24 16:00:30 +00001825BOOL32 WINAPI DlgDirSelectEx32A( HWND32 hwnd, LPSTR str, INT32 len, INT32 id )
Alexandre Julliard75d86e11996-11-17 18:59:11 +00001826{
1827 return DIALOG_DlgDirSelect( hwnd, str, len, id, TRUE, FALSE, FALSE );
1828}
1829
1830
1831/**********************************************************************
Alexandre Julliardc7c217b1998-04-13 12:21:30 +00001832 * DlgDirSelectEx32W (USER32.150)
Alexandre Julliard75d86e11996-11-17 18:59:11 +00001833 */
Alexandre Julliard670cdc41997-08-24 16:00:30 +00001834BOOL32 WINAPI DlgDirSelectEx32W( HWND32 hwnd, LPWSTR str, INT32 len, INT32 id )
Alexandre Julliard75d86e11996-11-17 18:59:11 +00001835{
1836 return DIALOG_DlgDirSelect( hwnd, (LPSTR)str, len, id, TRUE, TRUE, FALSE );
1837}
1838
1839
1840/**********************************************************************
1841 * DlgDirSelectComboBoxEx16 (USER.423)
1842 */
Alexandre Julliard670cdc41997-08-24 16:00:30 +00001843BOOL16 WINAPI DlgDirSelectComboBoxEx16( HWND16 hwnd, LPSTR str, INT16 len,
1844 INT16 id )
Alexandre Julliard75d86e11996-11-17 18:59:11 +00001845{
1846 return DIALOG_DlgDirSelect( hwnd, str, len, id, FALSE, FALSE, TRUE );
1847}
1848
1849
1850/**********************************************************************
Alexandre Julliardc7c217b1998-04-13 12:21:30 +00001851 * DlgDirSelectComboBoxEx32A (USER32.147)
Alexandre Julliard75d86e11996-11-17 18:59:11 +00001852 */
Alexandre Julliard670cdc41997-08-24 16:00:30 +00001853BOOL32 WINAPI DlgDirSelectComboBoxEx32A( HWND32 hwnd, LPSTR str, INT32 len,
1854 INT32 id )
Alexandre Julliard75d86e11996-11-17 18:59:11 +00001855{
1856 return DIALOG_DlgDirSelect( hwnd, str, len, id, TRUE, FALSE, TRUE );
1857}
1858
1859
1860/**********************************************************************
Alexandre Julliardc7c217b1998-04-13 12:21:30 +00001861 * DlgDirSelectComboBoxEx32W (USER32.148)
Alexandre Julliard75d86e11996-11-17 18:59:11 +00001862 */
Alexandre Julliard670cdc41997-08-24 16:00:30 +00001863BOOL32 WINAPI DlgDirSelectComboBoxEx32W( HWND32 hwnd, LPWSTR str, INT32 len,
1864 INT32 id)
Alexandre Julliard75d86e11996-11-17 18:59:11 +00001865{
1866 return DIALOG_DlgDirSelect( hwnd, (LPSTR)str, len, id, TRUE, TRUE, TRUE );
1867}
Alexandre Julliardda0cfb31996-12-01 17:17:47 +00001868
1869
1870/**********************************************************************
1871 * DlgDirList16 (USER.100)
1872 */
Alexandre Julliard670cdc41997-08-24 16:00:30 +00001873INT16 WINAPI DlgDirList16( HWND16 hDlg, LPSTR spec, INT16 idLBox,
1874 INT16 idStatic, UINT16 attrib )
Alexandre Julliardda0cfb31996-12-01 17:17:47 +00001875{
1876 return DIALOG_DlgDirList( hDlg, spec, idLBox, idStatic, attrib, FALSE );
1877}
1878
1879
1880/**********************************************************************
Alexandre Julliardc7c217b1998-04-13 12:21:30 +00001881 * DlgDirList32A (USER32.143)
Alexandre Julliardda0cfb31996-12-01 17:17:47 +00001882 */
Alexandre Julliard670cdc41997-08-24 16:00:30 +00001883INT32 WINAPI DlgDirList32A( HWND32 hDlg, LPSTR spec, INT32 idLBox,
1884 INT32 idStatic, UINT32 attrib )
Alexandre Julliardda0cfb31996-12-01 17:17:47 +00001885{
1886 return DIALOG_DlgDirList( hDlg, spec, idLBox, idStatic, attrib, FALSE );
1887}
1888
1889
1890/**********************************************************************
Alexandre Julliardc7c217b1998-04-13 12:21:30 +00001891 * DlgDirList32W (USER32.146)
Alexandre Julliardda0cfb31996-12-01 17:17:47 +00001892 */
Alexandre Julliard670cdc41997-08-24 16:00:30 +00001893INT32 WINAPI DlgDirList32W( HWND32 hDlg, LPWSTR spec, INT32 idLBox,
1894 INT32 idStatic, UINT32 attrib )
Alexandre Julliardda0cfb31996-12-01 17:17:47 +00001895{
Alexandre Julliard84c70f51997-05-09 08:40:27 +00001896 return DIALOG_DlgDirListW( hDlg, spec, idLBox, idStatic, attrib, FALSE );
Alexandre Julliardda0cfb31996-12-01 17:17:47 +00001897}
1898
1899
1900/**********************************************************************
1901 * DlgDirListComboBox16 (USER.195)
1902 */
Alexandre Julliard670cdc41997-08-24 16:00:30 +00001903INT16 WINAPI DlgDirListComboBox16( HWND16 hDlg, LPSTR spec, INT16 idCBox,
1904 INT16 idStatic, UINT16 attrib )
Alexandre Julliardda0cfb31996-12-01 17:17:47 +00001905{
1906 return DIALOG_DlgDirList( hDlg, spec, idCBox, idStatic, attrib, TRUE );
1907}
1908
1909
1910/**********************************************************************
Alexandre Julliardc7c217b1998-04-13 12:21:30 +00001911 * DlgDirListComboBox32A (USER32.144)
Alexandre Julliardda0cfb31996-12-01 17:17:47 +00001912 */
Alexandre Julliard670cdc41997-08-24 16:00:30 +00001913INT32 WINAPI DlgDirListComboBox32A( HWND32 hDlg, LPSTR spec, INT32 idCBox,
1914 INT32 idStatic, UINT32 attrib )
Alexandre Julliardda0cfb31996-12-01 17:17:47 +00001915{
1916 return DIALOG_DlgDirList( hDlg, spec, idCBox, idStatic, attrib, TRUE );
1917}
1918
1919
1920/**********************************************************************
Alexandre Julliardc7c217b1998-04-13 12:21:30 +00001921 * DlgDirListComboBox32W (USER32.145)
Alexandre Julliardda0cfb31996-12-01 17:17:47 +00001922 */
Alexandre Julliard670cdc41997-08-24 16:00:30 +00001923INT32 WINAPI DlgDirListComboBox32W( HWND32 hDlg, LPWSTR spec, INT32 idCBox,
1924 INT32 idStatic, UINT32 attrib )
Alexandre Julliardda0cfb31996-12-01 17:17:47 +00001925{
Alexandre Julliard84c70f51997-05-09 08:40:27 +00001926 return DIALOG_DlgDirListW( hDlg, spec, idCBox, idStatic, attrib, TRUE );
Alexandre Julliardda0cfb31996-12-01 17:17:47 +00001927}