Moved 16-bit dialog routines to a separate dialog16.c file.
Fixed window creation to create ASCII windows when called through one
of the ASCII dialog functions.
diff --git a/dlls/user/Makefile.in b/dlls/user/Makefile.in
index ad49c9c..21b9e1d 100644
--- a/dlls/user/Makefile.in
+++ b/dlls/user/Makefile.in
@@ -67,6 +67,7 @@
dde/ddeml16.c \
dde/misc.c \
dde/server.c \
+ dialog16.c \
display.c \
exticon.c \
focus.c \
diff --git a/dlls/user/controls.h b/dlls/user/controls.h
index 42f181e..32e150b 100644
--- a/dlls/user/controls.h
+++ b/dlls/user/controls.h
@@ -27,7 +27,8 @@
/* Built-in class names (see _Undocumented_Windows_ p.418) */
#define POPUPMENU_CLASS_ATOM MAKEINTATOMA(32768) /* PopupMenu */
#define DESKTOP_CLASS_ATOM MAKEINTATOMA(32769) /* Desktop */
-#define DIALOG_CLASS_ATOM MAKEINTATOMA(32770) /* Dialog */
+#define DIALOG_CLASS_ATOMA MAKEINTATOMA(32770) /* Dialog */
+#define DIALOG_CLASS_ATOMW MAKEINTATOMW(32770) /* Dialog */
#define WINSWITCH_CLASS_ATOM MAKEINTATOMA(32771) /* WinSwitch */
#define ICONTITLE_CLASS_ATOM MAKEINTATOMA(32772) /* IconTitle */
@@ -138,5 +139,9 @@
}
extern BOOL DIALOG_Init(void);
+extern BOOL DIALOG_GetCharSize( HFONT hFont, SIZE * pSize );
+extern void DIALOG_EnableOwner( HWND hOwner );
+extern BOOL DIALOG_DisableOwner( HWND hOwner );
+extern INT DIALOG_DoDialogBox( HWND hwnd, HWND owner );
#endif /* __WINE_CONTROLS_H */
diff --git a/dlls/user/dialog16.c b/dlls/user/dialog16.c
new file mode 100644
index 0000000..c0d6b2c
--- /dev/null
+++ b/dlls/user/dialog16.c
@@ -0,0 +1,778 @@
+/*
+ * 16-bit dialog functions
+ *
+ * Copyright 1993, 1994, 1996, 2003 Alexandre Julliard
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include "config.h"
+#include "wine/port.h"
+
+#include "windef.h"
+#include "wownt32.h"
+#include "wine/winuser16.h"
+#include "controls.h"
+#include "win.h"
+#include "user.h"
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(dialog);
+
+/* Dialog control information */
+typedef struct
+{
+ DWORD style;
+ INT16 x;
+ INT16 y;
+ INT16 cx;
+ INT16 cy;
+ UINT id;
+ LPCSTR className;
+ LPCSTR windowName;
+ LPCVOID data;
+} DLG_CONTROL_INFO;
+
+ /* Dialog template */
+typedef struct
+{
+ DWORD style;
+ UINT16 nbItems;
+ INT16 x;
+ INT16 y;
+ INT16 cx;
+ INT16 cy;
+ LPCSTR menuName;
+ LPCSTR className;
+ LPCSTR caption;
+ WORD pointSize;
+ LPCSTR faceName;
+} DLG_TEMPLATE;
+
+
+/***********************************************************************
+ * DIALOG_GetControl16
+ *
+ * Return the class and text of the control pointed to by ptr,
+ * fill the header structure and return a pointer to the next control.
+ */
+static LPCSTR DIALOG_GetControl16( LPCSTR p, DLG_CONTROL_INFO *info )
+{
+ static char buffer[10];
+ int int_id;
+
+ info->x = GET_WORD(p); p += sizeof(WORD);
+ info->y = GET_WORD(p); p += sizeof(WORD);
+ info->cx = GET_WORD(p); p += sizeof(WORD);
+ info->cy = GET_WORD(p); p += sizeof(WORD);
+ info->id = GET_WORD(p); p += sizeof(WORD);
+ info->style = GET_DWORD(p); p += sizeof(DWORD);
+
+ if (*p & 0x80)
+ {
+ switch((BYTE)*p)
+ {
+ case 0x80: strcpy( buffer, "BUTTON" ); break;
+ case 0x81: strcpy( buffer, "EDIT" ); break;
+ case 0x82: strcpy( buffer, "STATIC" ); break;
+ case 0x83: strcpy( buffer, "LISTBOX" ); break;
+ case 0x84: strcpy( buffer, "SCROLLBAR" ); break;
+ case 0x85: strcpy( buffer, "COMBOBOX" ); break;
+ default: buffer[0] = '\0'; break;
+ }
+ info->className = buffer;
+ p++;
+ }
+ else
+ {
+ info->className = p;
+ p += strlen(p) + 1;
+ }
+
+ int_id = ((BYTE)*p == 0xff);
+ if (int_id)
+ {
+ /* Integer id, not documented (?). Only works for SS_ICON controls */
+ info->windowName = (LPCSTR)(UINT)GET_WORD(p+1);
+ p += 3;
+ }
+ else
+ {
+ info->windowName = p;
+ p += strlen(p) + 1;
+ }
+
+ if (*p) info->data = p + 1;
+ else info->data = NULL;
+
+ p += *p + 1;
+
+ TRACE(" %s %s %d, %d, %d, %d, %d, %08lx, %p\n",
+ debugstr_a(info->className), debugstr_a(info->windowName),
+ info->id, info->x, info->y, info->cx, info->cy,
+ info->style, info->data );
+
+ return p;
+}
+
+
+/***********************************************************************
+ * DIALOG_CreateControls16
+ *
+ * Create the control windows for a dialog.
+ */
+static BOOL DIALOG_CreateControls16( HWND hwnd, LPCSTR template,
+ const DLG_TEMPLATE *dlgTemplate, HINSTANCE16 hInst )
+{
+ DIALOGINFO *dlgInfo = DIALOG_get_info( hwnd );
+ DLG_CONTROL_INFO info;
+ HWND hwndCtrl, hwndDefButton = 0;
+ INT items = dlgTemplate->nbItems;
+
+ TRACE(" BEGIN\n" );
+ while (items--)
+ {
+ HINSTANCE16 instance = hInst;
+ SEGPTR segptr;
+
+ template = DIALOG_GetControl16( template, &info );
+ if (HIWORD(info.className) && !strcmp( info.className, "EDIT") &&
+ !(GetWindowLongW( hwnd, GWL_STYLE ) & DS_LOCALEDIT))
+ {
+ if (!dlgInfo->hDialogHeap)
+ {
+ dlgInfo->hDialogHeap = GlobalAlloc16(GMEM_FIXED, 0x10000);
+ if (!dlgInfo->hDialogHeap)
+ {
+ ERR("Insufficient memory to create heap for edit control\n" );
+ continue;
+ }
+ LocalInit16(dlgInfo->hDialogHeap, 0, 0xffff);
+ }
+ instance = dlgInfo->hDialogHeap;
+ }
+
+ segptr = MapLS( info.data );
+ hwndCtrl = WIN_Handle32( CreateWindowEx16( WS_EX_NOPARENTNOTIFY,
+ info.className, info.windowName,
+ info.style | WS_CHILD,
+ MulDiv(info.x, dlgInfo->xBaseUnit, 4),
+ MulDiv(info.y, dlgInfo->yBaseUnit, 8),
+ MulDiv(info.cx, dlgInfo->xBaseUnit, 4),
+ MulDiv(info.cy, dlgInfo->yBaseUnit, 8),
+ HWND_16(hwnd), (HMENU16)info.id,
+ instance, (LPVOID)segptr ));
+ UnMapLS( segptr );
+
+ if (!hwndCtrl) return FALSE;
+
+ /* Send initialisation messages to the control */
+ if (dlgInfo->hUserFont) SendMessageA( hwndCtrl, WM_SETFONT,
+ (WPARAM)dlgInfo->hUserFont, 0 );
+ if (SendMessageA(hwndCtrl, WM_GETDLGCODE, 0, 0) & DLGC_DEFPUSHBUTTON)
+ {
+ /* If there's already a default push-button, set it back */
+ /* to normal and use this one instead. */
+ if (hwndDefButton)
+ SendMessageA( hwndDefButton, BM_SETSTYLE,
+ BS_PUSHBUTTON,FALSE );
+ hwndDefButton = hwndCtrl;
+ dlgInfo->idResult = GetWindowLongA( hwndCtrl, GWL_ID );
+ }
+ }
+ TRACE(" END\n" );
+ return TRUE;
+}
+
+
+/***********************************************************************
+ * DIALOG_ParseTemplate16
+ *
+ * Fill a DLG_TEMPLATE structure from the dialog template, and return
+ * a pointer to the first control.
+ */
+static LPCSTR DIALOG_ParseTemplate16( LPCSTR p, DLG_TEMPLATE * result )
+{
+ result->style = GET_DWORD(p); p += sizeof(DWORD);
+ result->nbItems = (unsigned char) *p++;
+ result->x = GET_WORD(p); p += sizeof(WORD);
+ result->y = GET_WORD(p); p += sizeof(WORD);
+ result->cx = GET_WORD(p); p += sizeof(WORD);
+ result->cy = GET_WORD(p); p += sizeof(WORD);
+
+ TRACE("DIALOG %d, %d, %d, %d\n", result->x, result->y, result->cx, result->cy );
+ TRACE(" STYLE %08lx\n", result->style );
+
+ /* Get the menu name */
+
+ switch( (BYTE)*p )
+ {
+ case 0:
+ result->menuName = 0;
+ p++;
+ break;
+ case 0xff:
+ result->menuName = (LPCSTR)(UINT)GET_WORD( p + 1 );
+ p += 3;
+ TRACE(" MENU %04x\n", LOWORD(result->menuName) );
+ break;
+ default:
+ result->menuName = p;
+ TRACE(" MENU '%s'\n", p );
+ p += strlen(p) + 1;
+ break;
+ }
+
+ /* Get the class name */
+
+ if (*p)
+ {
+ result->className = p;
+ TRACE(" CLASS '%s'\n", result->className );
+ }
+ else result->className = DIALOG_CLASS_ATOMA;
+ p += strlen(p) + 1;
+
+ /* Get the window caption */
+
+ result->caption = p;
+ p += strlen(p) + 1;
+ TRACE(" CAPTION '%s'\n", result->caption );
+
+ /* Get the font name */
+
+ if (result->style & DS_SETFONT)
+ {
+ result->pointSize = GET_WORD(p);
+ p += sizeof(WORD);
+ result->faceName = p;
+ p += strlen(p) + 1;
+ TRACE(" FONT %d,'%s'\n", result->pointSize, result->faceName );
+ }
+ return p;
+}
+
+
+/***********************************************************************
+ * DIALOG_CreateIndirect16
+ *
+ * Creates a dialog box window
+ *
+ * modal = TRUE if we are called from a modal dialog box.
+ * (it's more compatible to do it here, as under Windows the owner
+ * is never disabled if the dialog fails because of an invalid template)
+ */
+static HWND DIALOG_CreateIndirect16( HINSTANCE16 hInst, LPCVOID dlgTemplate,
+ HWND owner, DLGPROC16 dlgProc, LPARAM param,
+ BOOL modal )
+{
+ HWND hwnd;
+ RECT rect;
+ WND * wndPtr;
+ DLG_TEMPLATE template;
+ DIALOGINFO * dlgInfo;
+ BOOL ownerEnabled = TRUE;
+ DWORD exStyle = 0;
+ DWORD units = GetDialogBaseUnits();
+
+ /* Parse dialog template */
+
+ dlgTemplate = DIALOG_ParseTemplate16( dlgTemplate, &template );
+
+ /* Initialise dialog extra data */
+
+ if (!(dlgInfo = HeapAlloc( GetProcessHeap(), 0, sizeof(*dlgInfo) ))) return 0;
+ dlgInfo->hwndFocus = 0;
+ dlgInfo->hUserFont = 0;
+ dlgInfo->hMenu = 0;
+ dlgInfo->xBaseUnit = LOWORD(units);
+ dlgInfo->yBaseUnit = HIWORD(units);
+ dlgInfo->idResult = 0;
+ dlgInfo->flags = 0;
+ dlgInfo->hDialogHeap = 0;
+
+ /* Load menu */
+
+ if (template.menuName)
+ {
+ dlgInfo->hMenu = HMENU_32(LoadMenu16( hInst, template.menuName ));
+ }
+
+ /* Create custom font if needed */
+
+ if (template.style & DS_SETFONT)
+ {
+ /* We convert the size to pixels and then make it -ve. This works
+ * for both +ve and -ve template.pointSize */
+ HDC dc;
+ int pixels;
+ dc = GetDC(0);
+ pixels = MulDiv(template.pointSize, GetDeviceCaps(dc , LOGPIXELSY), 72);
+ ReleaseDC(0, dc);
+ dlgInfo->hUserFont = CreateFontA( -pixels, 0, 0, 0, FW_DONTCARE,
+ FALSE, FALSE, FALSE, DEFAULT_CHARSET, 0, 0,
+ PROOF_QUALITY, FF_DONTCARE, template.faceName );
+ if (dlgInfo->hUserFont)
+ {
+ SIZE charSize;
+ if (DIALOG_GetCharSize( dlgInfo->hUserFont, &charSize ))
+ {
+ dlgInfo->xBaseUnit = charSize.cx;
+ dlgInfo->yBaseUnit = charSize.cy;
+ }
+ }
+ TRACE("units = %d,%d\n", dlgInfo->xBaseUnit, dlgInfo->yBaseUnit );
+ }
+
+ /* Create dialog main window */
+
+ rect.left = rect.top = 0;
+ rect.right = MulDiv(template.cx, dlgInfo->xBaseUnit, 4);
+ rect.bottom = MulDiv(template.cy, dlgInfo->yBaseUnit, 8);
+ if (template.style & DS_MODALFRAME) exStyle |= WS_EX_DLGMODALFRAME;
+ AdjustWindowRectEx( &rect, template.style, (dlgInfo->hMenu != 0), exStyle );
+ rect.right -= rect.left;
+ rect.bottom -= rect.top;
+
+ if (template.x == CW_USEDEFAULT16)
+ {
+ rect.left = rect.top = CW_USEDEFAULT16;
+ }
+ else
+ {
+ if (template.style & DS_CENTER)
+ {
+ rect.left = (GetSystemMetrics(SM_CXSCREEN) - rect.right) / 2;
+ rect.top = (GetSystemMetrics(SM_CYSCREEN) - rect.bottom) / 2;
+ }
+ else
+ {
+ rect.left += MulDiv(template.x, dlgInfo->xBaseUnit, 4);
+ rect.top += MulDiv(template.y, dlgInfo->yBaseUnit, 8);
+ }
+ if ( !(template.style & WS_CHILD) )
+ {
+ INT16 dX, dY;
+
+ if( !(template.style & DS_ABSALIGN) )
+ ClientToScreen( owner, (POINT *)&rect );
+
+ /* try to fit it into the desktop */
+
+ if( (dX = rect.left + rect.right + GetSystemMetrics(SM_CXDLGFRAME)
+ - GetSystemMetrics(SM_CXSCREEN)) > 0 ) rect.left -= dX;
+ if( (dY = rect.top + rect.bottom + GetSystemMetrics(SM_CYDLGFRAME)
+ - GetSystemMetrics(SM_CYSCREEN)) > 0 ) rect.top -= dY;
+ if( rect.left < 0 ) rect.left = 0;
+ if( rect.top < 0 ) rect.top = 0;
+ }
+ }
+
+ if (modal)
+ {
+ ownerEnabled = DIALOG_DisableOwner( owner );
+ if (ownerEnabled) dlgInfo->flags |= DF_OWNERENABLED;
+ }
+
+ hwnd = WIN_Handle32( CreateWindowEx16(exStyle, template.className,
+ template.caption, template.style & ~WS_VISIBLE,
+ rect.left, rect.top, rect.right, rect.bottom,
+ HWND_16(owner), HMENU_16(dlgInfo->hMenu),
+ hInst, NULL ));
+ if (!hwnd)
+ {
+ if (dlgInfo->hUserFont) DeleteObject( dlgInfo->hUserFont );
+ if (dlgInfo->hMenu) DestroyMenu( dlgInfo->hMenu );
+ if (modal && (dlgInfo->flags & DF_OWNERENABLED)) DIALOG_EnableOwner(owner);
+ HeapFree( GetProcessHeap(), 0, dlgInfo );
+ return 0;
+ }
+ wndPtr = WIN_GetPtr( hwnd );
+ wndPtr->flags |= WIN_ISDIALOG;
+ WIN_ReleasePtr( wndPtr );
+
+ SetWindowLongW( hwnd, DWL_WINE_DIALOGINFO, (LONG)dlgInfo );
+ SetWindowLong16( HWND_16(hwnd), DWL_DLGPROC, (LONG)dlgProc );
+
+ if (dlgInfo->hUserFont)
+ SendMessageA( hwnd, WM_SETFONT, (WPARAM)dlgInfo->hUserFont, 0 );
+
+ /* Create controls */
+
+ if (DIALOG_CreateControls16( hwnd, dlgTemplate, &template, hInst ))
+ {
+ HWND hwndPreInitFocus;
+
+ /* Send initialisation messages and set focus */
+
+ dlgInfo->hwndFocus = GetNextDlgTabItem( hwnd, 0, FALSE );
+
+ hwndPreInitFocus = GetFocus();
+ if (SendMessageA( hwnd, WM_INITDIALOG, (WPARAM)dlgInfo->hwndFocus, param ))
+ {
+ /* check where the focus is again,
+ * some controls status might have changed in WM_INITDIALOG */
+ dlgInfo->hwndFocus = GetNextDlgTabItem( hwnd, 0, FALSE);
+ if( dlgInfo->hwndFocus )
+ SetFocus( dlgInfo->hwndFocus );
+ }
+ else
+ {
+ /* If the dlgproc has returned FALSE (indicating handling of keyboard focus)
+ but the focus has not changed, set the focus where we expect it. */
+ if ((GetFocus() == hwndPreInitFocus) &&
+ (GetWindowLongW( hwnd, GWL_STYLE ) & WS_VISIBLE))
+ {
+ dlgInfo->hwndFocus = GetNextDlgTabItem( hwnd, 0, FALSE);
+ if( dlgInfo->hwndFocus )
+ SetFocus( dlgInfo->hwndFocus );
+ }
+ }
+
+ if (template.style & WS_VISIBLE && !(GetWindowLongW( hwnd, GWL_STYLE ) & WS_VISIBLE))
+ {
+ ShowWindow( hwnd, SW_SHOWNORMAL ); /* SW_SHOW doesn't always work */
+ }
+ return hwnd;
+ }
+ if( IsWindow(hwnd) ) DestroyWindow( hwnd );
+ if (modal && ownerEnabled) DIALOG_EnableOwner(owner);
+ return 0;
+}
+
+
+/***********************************************************************
+ * DialogBox (USER.87)
+ */
+INT16 WINAPI DialogBox16( HINSTANCE16 hInst, LPCSTR dlgTemplate,
+ HWND16 owner, DLGPROC16 dlgProc )
+{
+ return DialogBoxParam16( hInst, dlgTemplate, owner, dlgProc, 0 );
+}
+
+
+/**************************************************************************
+ * EndDialog (USER.88)
+ */
+BOOL16 WINAPI EndDialog16( HWND16 hwnd, INT16 retval )
+{
+ return EndDialog( WIN_Handle32(hwnd), retval );
+}
+
+
+/***********************************************************************
+ * CreateDialog (USER.89)
+ */
+HWND16 WINAPI CreateDialog16( HINSTANCE16 hInst, LPCSTR dlgTemplate,
+ HWND16 owner, DLGPROC16 dlgProc )
+{
+ return CreateDialogParam16( hInst, dlgTemplate, owner, dlgProc, 0 );
+}
+
+
+/**************************************************************************
+ * GetDlgItem (USER.91)
+ */
+HWND16 WINAPI GetDlgItem16( HWND16 hwndDlg, INT16 id )
+{
+ return HWND_16( GetDlgItem( WIN_Handle32(hwndDlg), (UINT16) id ));
+}
+
+
+/**************************************************************************
+ * SetDlgItemText (USER.92)
+ */
+void WINAPI SetDlgItemText16( HWND16 hwnd, INT16 id, SEGPTR lpString )
+{
+ SendDlgItemMessage16( hwnd, id, WM_SETTEXT, 0, (LPARAM)lpString );
+}
+
+
+/**************************************************************************
+ * GetDlgItemText (USER.93)
+ */
+INT16 WINAPI GetDlgItemText16( HWND16 hwnd, INT16 id, SEGPTR str, UINT16 len )
+{
+ return (INT16)SendDlgItemMessage16( hwnd, id, WM_GETTEXT, len, (LPARAM)str );
+}
+
+
+/**************************************************************************
+ * SetDlgItemInt (USER.94)
+ */
+void WINAPI SetDlgItemInt16( HWND16 hwnd, INT16 id, UINT16 value, BOOL16 fSigned )
+{
+ SetDlgItemInt( WIN_Handle32(hwnd), (UINT)(UINT16)id,
+ (UINT)(fSigned ? (INT16) value : (UINT16) value), fSigned );
+}
+
+
+/**************************************************************************
+ * GetDlgItemInt (USER.95)
+ */
+UINT16 WINAPI GetDlgItemInt16( HWND16 hwnd, INT16 id, BOOL16 *translated, BOOL16 fSigned )
+{
+ UINT result;
+ BOOL ok;
+
+ if (translated) *translated = FALSE;
+ result = GetDlgItemInt( WIN_Handle32(hwnd), (UINT)(UINT16)id, &ok, fSigned );
+ if (!ok) return 0;
+ if (fSigned)
+ {
+ if (((INT)result < -32767) || ((INT)result > 32767)) return 0;
+ }
+ else
+ {
+ if (result > 65535) return 0;
+ }
+ if (translated) *translated = TRUE;
+ return (UINT16)result;
+}
+
+
+/**************************************************************************
+ * CheckRadioButton (USER.96)
+ */
+BOOL16 WINAPI CheckRadioButton16( HWND16 hwndDlg, UINT16 firstID,
+ UINT16 lastID, UINT16 checkID )
+{
+ return CheckRadioButton( WIN_Handle32(hwndDlg), firstID, lastID, checkID );
+}
+
+
+/**************************************************************************
+ * CheckDlgButton (USER.97)
+ */
+BOOL16 WINAPI CheckDlgButton16( HWND16 hwnd, INT16 id, UINT16 check )
+{
+ SendDlgItemMessage16( hwnd, id, BM_SETCHECK16, check, 0 );
+ return TRUE;
+}
+
+
+/**************************************************************************
+ * IsDlgButtonChecked (USER.98)
+ */
+UINT16 WINAPI IsDlgButtonChecked16( HWND16 hwnd, UINT16 id )
+{
+ return (UINT16)SendDlgItemMessage16( hwnd, id, BM_GETCHECK16, 0, 0 );
+}
+
+
+/**************************************************************************
+ * DlgDirSelect (USER.99)
+ */
+BOOL16 WINAPI DlgDirSelect16( HWND16 hwnd, LPSTR str, INT16 id )
+{
+ return DlgDirSelectEx16( hwnd, str, 128, id );
+}
+
+
+/**************************************************************************
+ * DlgDirList (USER.100)
+ */
+INT16 WINAPI DlgDirList16( HWND16 hDlg, LPSTR spec, INT16 idLBox,
+ INT16 idStatic, UINT16 attrib )
+{
+ /* according to Win16 docs, DDL_DRIVES should make DDL_EXCLUSIVE
+ * be set automatically (this is different in Win32, and
+ * DIALOG_DlgDirList sends Win32 messages to the control,
+ * so do it here) */
+ if (attrib & DDL_DRIVES) attrib |= DDL_EXCLUSIVE;
+ return DlgDirListA( WIN_Handle32(hDlg), spec, idLBox, idStatic, attrib );
+}
+
+
+/**************************************************************************
+ * SendDlgItemMessage (USER.101)
+ */
+LRESULT WINAPI SendDlgItemMessage16( HWND16 hwnd, INT16 id, UINT16 msg,
+ WPARAM16 wParam, LPARAM lParam )
+{
+ HWND16 hwndCtrl = GetDlgItem16( hwnd, id );
+ if (hwndCtrl) return SendMessage16( hwndCtrl, msg, wParam, lParam );
+ else return 0;
+}
+
+
+/**************************************************************************
+ * MapDialogRect (USER.103)
+ */
+void WINAPI MapDialogRect16( HWND16 hwnd, LPRECT16 rect )
+{
+ RECT rect32;
+ MapDialogRect( WIN_Handle32(hwnd), &rect32 );
+ rect->left = rect32.left;
+ rect->right = rect32.right;
+ rect->top = rect32.top;
+ rect->bottom = rect32.bottom;
+}
+
+
+/**************************************************************************
+ * DlgDirSelectComboBox (USER.194)
+ */
+BOOL16 WINAPI DlgDirSelectComboBox16( HWND16 hwnd, LPSTR str, INT16 id )
+{
+ return DlgDirSelectComboBoxEx16( hwnd, str, 128, id );
+}
+
+
+/**************************************************************************
+ * DlgDirListComboBox (USER.195)
+ */
+INT16 WINAPI DlgDirListComboBox16( HWND16 hDlg, LPSTR spec, INT16 idCBox,
+ INT16 idStatic, UINT16 attrib )
+{
+ return DlgDirListComboBoxA( WIN_Handle32(hDlg), spec, idCBox, idStatic, attrib );
+}
+
+
+/***********************************************************************
+ * DialogBoxIndirect (USER.218)
+ */
+INT16 WINAPI DialogBoxIndirect16( HINSTANCE16 hInst, HANDLE16 dlgTemplate,
+ HWND16 owner, DLGPROC16 dlgProc )
+{
+ return DialogBoxIndirectParam16( hInst, dlgTemplate, owner, dlgProc, 0 );
+}
+
+
+/***********************************************************************
+ * CreateDialogIndirect (USER.219)
+ */
+HWND16 WINAPI CreateDialogIndirect16( HINSTANCE16 hInst, LPCVOID dlgTemplate,
+ HWND16 owner, DLGPROC16 dlgProc )
+{
+ return CreateDialogIndirectParam16( hInst, dlgTemplate, owner, dlgProc, 0);
+}
+
+
+/**************************************************************************
+ * GetNextDlgGroupItem (USER.227)
+ */
+HWND16 WINAPI GetNextDlgGroupItem16( HWND16 hwndDlg, HWND16 hwndCtrl,
+ BOOL16 fPrevious )
+{
+ return HWND_16( GetNextDlgGroupItem( WIN_Handle32(hwndDlg), WIN_Handle32(hwndCtrl), fPrevious ));
+}
+
+
+/**************************************************************************
+ * GetNextDlgTabItem (USER.228)
+ */
+HWND16 WINAPI GetNextDlgTabItem16( HWND16 hwndDlg, HWND16 hwndCtrl,
+ BOOL16 fPrevious )
+{
+ return HWND_16( GetNextDlgTabItem( WIN_Handle32(hwndDlg), WIN_Handle32(hwndCtrl), fPrevious ));
+}
+
+
+/***********************************************************************
+ * DialogBoxParam (USER.239)
+ */
+INT16 WINAPI DialogBoxParam16( HINSTANCE16 hInst, LPCSTR template,
+ HWND16 owner16, DLGPROC16 dlgProc, LPARAM param )
+{
+ HWND hwnd = 0;
+ HRSRC16 hRsrc;
+ HGLOBAL16 hmem;
+ LPCVOID data;
+ int ret = -1;
+
+ if (!(hRsrc = FindResource16( hInst, template, RT_DIALOGA ))) return 0;
+ if (!(hmem = LoadResource16( hInst, hRsrc ))) return 0;
+ if ((data = LockResource16( hmem )))
+ {
+ HWND owner = WIN_Handle32(owner16);
+ hwnd = DIALOG_CreateIndirect16( hInst, data, owner, dlgProc, param, TRUE );
+ if (hwnd) ret = DIALOG_DoDialogBox( hwnd, owner );
+ GlobalUnlock16( hmem );
+ }
+ FreeResource16( hmem );
+ return ret;
+}
+
+
+/***********************************************************************
+ * DialogBoxIndirectParam (USER.240)
+ */
+INT16 WINAPI DialogBoxIndirectParam16( HINSTANCE16 hInst, HANDLE16 dlgTemplate,
+ HWND16 owner16, DLGPROC16 dlgProc, LPARAM param )
+{
+ HWND hwnd, owner = WIN_Handle32( owner16 );
+ LPCVOID ptr;
+
+ if (!(ptr = GlobalLock16( dlgTemplate ))) return -1;
+ hwnd = DIALOG_CreateIndirect16( hInst, ptr, owner, dlgProc, param, TRUE );
+ GlobalUnlock16( dlgTemplate );
+ if (hwnd) return DIALOG_DoDialogBox( hwnd, owner );
+ return -1;
+}
+
+
+/***********************************************************************
+ * CreateDialogParam (USER.241)
+ */
+HWND16 WINAPI CreateDialogParam16( HINSTANCE16 hInst, LPCSTR dlgTemplate,
+ HWND16 owner, DLGPROC16 dlgProc, LPARAM param )
+{
+ HWND16 hwnd = 0;
+ HRSRC16 hRsrc;
+ HGLOBAL16 hmem;
+ LPCVOID data;
+
+ TRACE("%04x,%s,%04x,%08lx,%ld\n",
+ hInst, debugstr_a(dlgTemplate), owner, (DWORD)dlgProc, param );
+
+ if (!(hRsrc = FindResource16( hInst, dlgTemplate, RT_DIALOGA ))) return 0;
+ if (!(hmem = LoadResource16( hInst, hRsrc ))) return 0;
+ if (!(data = LockResource16( hmem ))) hwnd = 0;
+ else hwnd = CreateDialogIndirectParam16( hInst, data, owner, dlgProc, param );
+ FreeResource16( hmem );
+ return hwnd;
+}
+
+
+/***********************************************************************
+ * CreateDialogIndirectParam (USER.242)
+ */
+HWND16 WINAPI CreateDialogIndirectParam16( HINSTANCE16 hInst, LPCVOID dlgTemplate,
+ HWND16 owner, DLGPROC16 dlgProc, LPARAM param )
+{
+ if (!dlgTemplate) return 0;
+ return HWND_16( DIALOG_CreateIndirect16( hInst, dlgTemplate, WIN_Handle32(owner),
+ dlgProc, param, FALSE ));
+}
+
+
+/**************************************************************************
+ * DlgDirSelectEx (USER.422)
+ */
+BOOL16 WINAPI DlgDirSelectEx16( HWND16 hwnd, LPSTR str, INT16 len, INT16 id )
+{
+ return DlgDirSelectExA( WIN_Handle32(hwnd), str, len, id );
+}
+
+
+/**************************************************************************
+ * DlgDirSelectComboBoxEx (USER.423)
+ */
+BOOL16 WINAPI DlgDirSelectComboBoxEx16( HWND16 hwnd, LPSTR str, INT16 len,
+ INT16 id )
+{
+ return DlgDirSelectComboBoxExA( WIN_Handle32(hwnd), str, len, id );
+}
diff --git a/dlls/user/user32.spec b/dlls/user/user32.spec
index 946ca82..0ba264e 100644
--- a/dlls/user/user32.spec
+++ b/dlls/user/user32.spec
@@ -70,7 +70,7 @@
@ stdcall CreateDesktopA(str str ptr long long ptr)
@ stdcall CreateDesktopW(wstr wstr ptr long long ptr)
@ stdcall CreateDialogIndirectParamA(long ptr long ptr long)
-@ stdcall CreateDialogIndirectParamAorW (long ptr long ptr long)
+@ stdcall CreateDialogIndirectParamAorW(long ptr long ptr long long)
@ stdcall CreateDialogIndirectParamW(long ptr long ptr long)
@ stdcall CreateDialogParamA(long ptr long ptr long)
@ stdcall CreateDialogParamW(long ptr long ptr long)
diff --git a/dlls/user/wnd16.c b/dlls/user/wnd16.c
index affe2e3..95e8110 100644
--- a/dlls/user/wnd16.c
+++ b/dlls/user/wnd16.c
@@ -524,155 +524,6 @@
/**************************************************************************
- * EndDialog (USER.88)
- */
-BOOL16 WINAPI EndDialog16( HWND16 hwnd, INT16 retval )
-{
- return EndDialog( WIN_Handle32(hwnd), retval );
-}
-
-
-/**************************************************************************
- * GetDlgItem (USER.91)
- */
-HWND16 WINAPI GetDlgItem16( HWND16 hwndDlg, INT16 id )
-{
- return HWND_16( GetDlgItem( WIN_Handle32(hwndDlg), (UINT16) id ));
-}
-
-
-/**************************************************************************
- * SetDlgItemText (USER.92)
- */
-void WINAPI SetDlgItemText16( HWND16 hwnd, INT16 id, SEGPTR lpString )
-{
- SendDlgItemMessage16( hwnd, id, WM_SETTEXT, 0, (LPARAM)lpString );
-}
-
-
-/**************************************************************************
- * GetDlgItemText (USER.93)
- */
-INT16 WINAPI GetDlgItemText16( HWND16 hwnd, INT16 id, SEGPTR str, UINT16 len )
-{
- return (INT16)SendDlgItemMessage16( hwnd, id, WM_GETTEXT, len, (LPARAM)str );
-}
-
-
-/**************************************************************************
- * SetDlgItemInt (USER.94)
- */
-void WINAPI SetDlgItemInt16( HWND16 hwnd, INT16 id, UINT16 value, BOOL16 fSigned )
-{
- SetDlgItemInt( WIN_Handle32(hwnd), (UINT)(UINT16)id,
- (UINT)(fSigned ? (INT16) value : (UINT16) value), fSigned );
-}
-
-
-/**************************************************************************
- * GetDlgItemInt (USER.95)
- */
-UINT16 WINAPI GetDlgItemInt16( HWND16 hwnd, INT16 id, BOOL16 *translated, BOOL16 fSigned )
-{
- UINT result;
- BOOL ok;
-
- if (translated) *translated = FALSE;
- result = GetDlgItemInt( WIN_Handle32(hwnd), (UINT)(UINT16)id, &ok, fSigned );
- if (!ok) return 0;
- if (fSigned)
- {
- if (((INT)result < -32767) || ((INT)result > 32767)) return 0;
- }
- else
- {
- if (result > 65535) return 0;
- }
- if (translated) *translated = TRUE;
- return (UINT16)result;
-}
-
-
-/**************************************************************************
- * CheckRadioButton (USER.96)
- */
-BOOL16 WINAPI CheckRadioButton16( HWND16 hwndDlg, UINT16 firstID,
- UINT16 lastID, UINT16 checkID )
-{
- return CheckRadioButton( WIN_Handle32(hwndDlg), firstID, lastID, checkID );
-}
-
-
-/**************************************************************************
- * CheckDlgButton (USER.97)
- */
-BOOL16 WINAPI CheckDlgButton16( HWND16 hwnd, INT16 id, UINT16 check )
-{
- SendDlgItemMessage16( hwnd, id, BM_SETCHECK16, check, 0 );
- return TRUE;
-}
-
-
-/**************************************************************************
- * IsDlgButtonChecked (USER.98)
- */
-UINT16 WINAPI IsDlgButtonChecked16( HWND16 hwnd, UINT16 id )
-{
- return (UINT16)SendDlgItemMessage16( hwnd, id, BM_GETCHECK16, 0, 0 );
-}
-
-
-/**************************************************************************
- * DlgDirSelect (USER.99)
- */
-BOOL16 WINAPI DlgDirSelect16( HWND16 hwnd, LPSTR str, INT16 id )
-{
- return DlgDirSelectEx16( hwnd, str, 128, id );
-}
-
-
-/**************************************************************************
- * DlgDirList (USER.100)
- */
-INT16 WINAPI DlgDirList16( HWND16 hDlg, LPSTR spec, INT16 idLBox,
- INT16 idStatic, UINT16 attrib )
-{
- /* according to Win16 docs, DDL_DRIVES should make DDL_EXCLUSIVE
- * be set automatically (this is different in Win32, and
- * DIALOG_DlgDirList sends Win32 messages to the control,
- * so do it here) */
- if (attrib & DDL_DRIVES) attrib |= DDL_EXCLUSIVE;
- return DlgDirListA( WIN_Handle32(hDlg), spec, idLBox, idStatic, attrib );
-}
-
-
-/**************************************************************************
- * SendDlgItemMessage (USER.101)
- */
-LRESULT WINAPI SendDlgItemMessage16( HWND16 hwnd, INT16 id, UINT16 msg,
- WPARAM16 wParam, LPARAM lParam )
-{
- HWND16 hwndCtrl = GetDlgItem16( hwnd, id );
- if (hwndCtrl) return SendMessage16( hwndCtrl, msg, wParam, lParam );
- else return 0;
-}
-
-
-/**************************************************************************
- * MapDialogRect (USER.103)
- */
-void WINAPI MapDialogRect16( HWND16 hwnd, LPRECT16 rect )
-{
- RECT rect32;
- MapDialogRect( WIN_Handle32(hwnd), &rect32 );
- rect->left = rect32.left;
- rect->right = rect32.right;
- rect->top = rect32.top;
- rect->bottom = rect32.bottom;
-}
-
-
-/**************************************************************************
* FlashWindow (USER.105)
*/
BOOL16 WINAPI FlashWindow16( HWND16 hwnd, BOOL16 bInvert )
@@ -1011,25 +862,6 @@
}
-/**************************************************************************
- * DlgDirSelectComboBox (USER.194)
- */
-BOOL16 WINAPI DlgDirSelectComboBox16( HWND16 hwnd, LPSTR str, INT16 id )
-{
- return DlgDirSelectComboBoxEx16( hwnd, str, 128, id );
-}
-
-
-/**************************************************************************
- * DlgDirListComboBox (USER.195)
- */
-INT16 WINAPI DlgDirListComboBox16( HWND16 hDlg, LPSTR spec, INT16 idCBox,
- INT16 idStatic, UINT16 attrib )
-{
- return DlgDirListComboBoxA( WIN_Handle32(hDlg), spec, idCBox, idStatic, attrib );
-}
-
-
/***********************************************************************
* GetWindowTask (USER.224)
*/
@@ -1056,28 +888,6 @@
/**************************************************************************
- * GetNextDlgGroupItem (USER.227)
- */
-HWND16 WINAPI GetNextDlgGroupItem16( HWND16 hwndDlg, HWND16 hwndCtrl,
- BOOL16 fPrevious )
-{
- return HWND_16( GetNextDlgGroupItem( WIN_Handle32(hwndDlg),
- WIN_Handle32(hwndCtrl), fPrevious ));
-}
-
-
-/**************************************************************************
- * GetNextDlgTabItem (USER.228)
- */
-HWND16 WINAPI GetNextDlgTabItem16( HWND16 hwndDlg, HWND16 hwndCtrl,
- BOOL16 fPrevious )
-{
- return HWND_16( GetNextDlgTabItem( WIN_Handle32(hwndDlg),
- WIN_Handle32(hwndCtrl), fPrevious ));
-}
-
-
-/**************************************************************************
* GetTopWindow (USER.229)
*/
HWND16 WINAPI GetTopWindow16( HWND16 hwnd )
@@ -1451,25 +1261,6 @@
/**************************************************************************
- * DlgDirSelectEx (USER.422)
- */
-BOOL16 WINAPI DlgDirSelectEx16( HWND16 hwnd, LPSTR str, INT16 len, INT16 id )
-{
- return DlgDirSelectExA( WIN_Handle32(hwnd), str, len, id );
-}
-
-
-/**************************************************************************
- * DlgDirSelectComboBoxEx (USER.423)
- */
-BOOL16 WINAPI DlgDirSelectComboBoxEx16( HWND16 hwnd, LPSTR str, INT16 len,
- INT16 id )
-{
- return DlgDirSelectComboBoxExA( WIN_Handle32(hwnd), str, len, id );
-}
-
-
-/**************************************************************************
* FindWindowEx (USER.427)
*/
HWND16 WINAPI FindWindowEx16( HWND16 parent, HWND16 child, LPCSTR className, LPCSTR title )
diff --git a/windows/dialog.c b/windows/dialog.c
index f37bd62..f051450 100644
--- a/windows/dialog.c
+++ b/windows/dialog.c
@@ -33,10 +33,7 @@
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
-#include "windowsx.h"
#include "wine/winuser16.h"
-#include "wine/winbase16.h"
-#include "wownt32.h"
#include "wine/unicode.h"
#include "controls.h"
#include "heap.h"
@@ -58,8 +55,8 @@
INT16 cx;
INT16 cy;
UINT id;
- LPCSTR className;
- LPCSTR windowName;
+ LPCWSTR className;
+ LPCWSTR windowName;
LPCVOID data;
} DLG_CONTROL_INFO;
@@ -74,14 +71,14 @@
INT16 y;
INT16 cx;
INT16 cy;
- LPCSTR menuName;
- LPCSTR className;
- LPCSTR caption;
+ LPCWSTR menuName;
+ LPCWSTR className;
+ LPCWSTR caption;
WORD pointSize;
WORD weight;
- BOOL italic;
- LPCSTR faceName;
- BOOL dialogEx;
+ BOOL italic;
+ LPCWSTR faceName;
+ BOOL dialogEx;
} DLG_TEMPLATE;
/* Radio button group */
@@ -101,7 +98,7 @@
*/
const struct builtin_class_descr DIALOG_builtin_class =
{
- DIALOG_CLASS_ATOM, /* name */
+ DIALOG_CLASS_ATOMA, /* name */
CS_GLOBALCLASS | CS_SAVEBITS | CS_DBLCLKS, /* style */
DefDlgProcA, /* procA */
DefDlgProcW, /* procW */
@@ -169,14 +166,14 @@
if(!hDC) return FALSE;
- if(hFont) hFontPrev = SelectFont(hDC, hFont);
+ if(hFont) hFontPrev = SelectObject(hDC, hFont);
if(!GetTextMetricsA(hDC, &tm)) return FALSE;
if(!GetTextExtentPointA(hDC, alphabet, 52, &sz)) return FALSE;
pSize->cy = tm.tmHeight;
pSize->cx = (sz.cx / 26 + 1) / 2;
- if (hFontPrev) SelectFont(hDC, hFontPrev);
+ if (hFontPrev) SelectObject(hDC, hFontPrev);
TRACE("dlg base units: %ld x %ld\n", pSize->cx, pSize->cy);
return TRUE;
@@ -187,7 +184,7 @@
*
* A convenient variant of DIALOG_GetCharSizeFromDC.
*/
-static BOOL DIALOG_GetCharSize( HFONT hFont, SIZE * pSize )
+BOOL DIALOG_GetCharSize( HFONT hFont, SIZE * pSize )
{
HDC hDC = GetDC(0);
BOOL Success = DIALOG_GetCharSizeFromDC( hDC, hFont, pSize );
@@ -230,79 +227,6 @@
/***********************************************************************
- * DIALOG_GetControl16
- *
- * Return the class and text of the control pointed to by ptr,
- * fill the header structure and return a pointer to the next control.
- */
-static LPCSTR DIALOG_GetControl16( LPCSTR p, DLG_CONTROL_INFO *info )
-{
- static char buffer[10];
- int int_id;
-
- info->x = GET_WORD(p); p += sizeof(WORD);
- info->y = GET_WORD(p); p += sizeof(WORD);
- info->cx = GET_WORD(p); p += sizeof(WORD);
- info->cy = GET_WORD(p); p += sizeof(WORD);
- info->id = GET_WORD(p); p += sizeof(WORD);
- info->style = GET_DWORD(p); p += sizeof(DWORD);
- info->exStyle = 0;
-
- if (*p & 0x80)
- {
- switch((BYTE)*p)
- {
- case 0x80: strcpy( buffer, "BUTTON" ); break;
- case 0x81: strcpy( buffer, "EDIT" ); break;
- case 0x82: strcpy( buffer, "STATIC" ); break;
- case 0x83: strcpy( buffer, "LISTBOX" ); break;
- case 0x84: strcpy( buffer, "SCROLLBAR" ); break;
- case 0x85: strcpy( buffer, "COMBOBOX" ); break;
- default: buffer[0] = '\0'; break;
- }
- info->className = buffer;
- p++;
- }
- else
- {
- info->className = p;
- p += strlen(p) + 1;
- }
-
- int_id = ((BYTE)*p == 0xff);
- if (int_id)
- {
- /* Integer id, not documented (?). Only works for SS_ICON controls */
- info->windowName = (LPCSTR)(UINT)GET_WORD(p+1);
- p += 3;
- }
- else
- {
- info->windowName = p;
- p += strlen(p) + 1;
- }
-
- if (*p) info->data = p + 1;
- else info->data = NULL;
-
- p += *p + 1;
-
- if(int_id)
- TRACE(" %s %04x %d, %d, %d, %d, %d, %08lx, %p\n",
- info->className, LOWORD(info->windowName),
- info->id, info->x, info->y, info->cx, info->cy,
- info->style, info->data );
- else
- TRACE(" %s '%s' %d, %d, %d, %d, %d, %08lx, %p\n",
- info->className, info->windowName,
- info->id, info->x, info->y, info->cx, info->cy,
- info->style, info->data );
-
- return p;
-}
-
-
-/***********************************************************************
* DIALOG_GetControl32
*
* Return the class and text of the control pointed to by ptr,
@@ -353,7 +277,7 @@
};
WORD id = GET_WORD(p+1);
if ((id >= 0x80) && (id <= 0x85))
- info->className = (LPCSTR)class_names[id - 0x80];
+ info->className = class_names[id - 0x80];
else
{
info->className = NULL;
@@ -363,24 +287,23 @@
}
else
{
- info->className = (LPCSTR)p;
- p += strlenW( (LPCWSTR)p ) + 1;
+ info->className = (LPCWSTR)p;
+ p += strlenW( info->className ) + 1;
}
if (GET_WORD(p) == 0xffff) /* Is it an integer id? */
{
- info->windowName = (LPCSTR)(UINT)GET_WORD(p + 1);
+ info->windowName = (LPCWSTR)(UINT)GET_WORD(p + 1);
p += 2;
}
else
{
- info->windowName = (LPCSTR)p;
- p += strlenW( (LPCWSTR)p ) + 1;
+ info->windowName = (LPCWSTR)p;
+ p += strlenW( info->windowName ) + 1;
}
TRACE(" %s %s %d, %d, %d, %d, %d, %08lx, %08lx, %08lx\n",
- debugstr_w( (LPCWSTR)info->className ),
- debugstr_w( (LPCWSTR)info->windowName ),
+ debugstr_w( info->className ), debugstr_w( info->windowName ),
info->id, info->x, info->y, info->cx, info->cy,
info->style, info->exStyle, info->helpId );
@@ -407,81 +330,12 @@
/***********************************************************************
- * DIALOG_CreateControls16
- *
- * Create the control windows for a dialog.
- */
-static BOOL DIALOG_CreateControls16( HWND hwnd, LPCSTR template,
- const DLG_TEMPLATE *dlgTemplate, HINSTANCE16 hInst )
-{
- DIALOGINFO *dlgInfo = DIALOG_get_info( hwnd );
- DLG_CONTROL_INFO info;
- HWND hwndCtrl, hwndDefButton = 0;
- INT items = dlgTemplate->nbItems;
-
- TRACE(" BEGIN\n" );
- while (items--)
- {
- HINSTANCE16 instance = hInst;
- SEGPTR segptr;
-
- template = DIALOG_GetControl16( template, &info );
- if (HIWORD(info.className) && !strcmp( info.className, "EDIT") &&
- !(GetWindowLongW( hwnd, GWL_STYLE ) & DS_LOCALEDIT))
- {
- if (!dlgInfo->hDialogHeap)
- {
- dlgInfo->hDialogHeap = GlobalAlloc16(GMEM_FIXED, 0x10000);
- if (!dlgInfo->hDialogHeap)
- {
- ERR("Insufficient memory to create heap for edit control\n" );
- continue;
- }
- LocalInit16(dlgInfo->hDialogHeap, 0, 0xffff);
- }
- instance = dlgInfo->hDialogHeap;
- }
-
- segptr = MapLS( info.data );
- hwndCtrl = WIN_Handle32( CreateWindowEx16( info.exStyle | WS_EX_NOPARENTNOTIFY,
- info.className, info.windowName,
- info.style | WS_CHILD,
- MulDiv(info.x, dlgInfo->xBaseUnit, 4),
- MulDiv(info.y, dlgInfo->yBaseUnit, 8),
- MulDiv(info.cx, dlgInfo->xBaseUnit, 4),
- MulDiv(info.cy, dlgInfo->yBaseUnit, 8),
- HWND_16(hwnd), (HMENU16)info.id,
- instance, (LPVOID)segptr ));
- UnMapLS( segptr );
-
- if (!hwndCtrl) return FALSE;
-
- /* Send initialisation messages to the control */
- if (dlgInfo->hUserFont) SendMessageA( hwndCtrl, WM_SETFONT,
- (WPARAM)dlgInfo->hUserFont, 0 );
- if (SendMessageA(hwndCtrl, WM_GETDLGCODE, 0, 0) & DLGC_DEFPUSHBUTTON)
- {
- /* If there's already a default push-button, set it back */
- /* to normal and use this one instead. */
- if (hwndDefButton)
- SendMessageA( hwndDefButton, BM_SETSTYLE,
- BS_PUSHBUTTON,FALSE );
- hwndDefButton = hwndCtrl;
- dlgInfo->idResult = GetWindowLongA( hwndCtrl, GWL_ID );
- }
- }
- TRACE(" END\n" );
- return TRUE;
-}
-
-
-/***********************************************************************
* DIALOG_CreateControls32
*
* Create the control windows for a dialog.
*/
-static BOOL DIALOG_CreateControls32( HWND hwnd, LPCSTR template,
- const DLG_TEMPLATE *dlgTemplate, HINSTANCE hInst )
+static BOOL DIALOG_CreateControls32( HWND hwnd, LPCSTR template, const DLG_TEMPLATE *dlgTemplate,
+ HINSTANCE hInst, BOOL unicode )
{
DIALOGINFO *dlgInfo = DIALOG_get_info( hwnd );
DLG_CONTROL_INFO info;
@@ -499,17 +353,51 @@
info.style &= ~WS_BORDER;
info.exStyle |= WS_EX_CLIENTEDGE;
}
- hwndCtrl = CreateWindowExW( info.exStyle | WS_EX_NOPARENTNOTIFY,
- (LPCWSTR)info.className,
- (LPCWSTR)info.windowName,
- info.style | WS_CHILD,
- MulDiv(info.x, dlgInfo->xBaseUnit, 4),
- MulDiv(info.y, dlgInfo->yBaseUnit, 8),
- MulDiv(info.cx, dlgInfo->xBaseUnit, 4),
- MulDiv(info.cy, dlgInfo->yBaseUnit, 8),
- hwnd, (HMENU)info.id,
- hInst, (LPVOID)info.data );
- if (!hwndCtrl) return FALSE;
+ if (unicode)
+ {
+ hwndCtrl = CreateWindowExW( info.exStyle | WS_EX_NOPARENTNOTIFY,
+ info.className, info.windowName,
+ info.style | WS_CHILD,
+ MulDiv(info.x, dlgInfo->xBaseUnit, 4),
+ MulDiv(info.y, dlgInfo->yBaseUnit, 8),
+ MulDiv(info.cx, dlgInfo->xBaseUnit, 4),
+ MulDiv(info.cy, dlgInfo->yBaseUnit, 8),
+ hwnd, (HMENU)info.id,
+ hInst, (LPVOID)info.data );
+ }
+ else
+ {
+ LPSTR class = (LPSTR)info.className;
+ LPSTR caption = (LPSTR)info.windowName;
+
+ if (HIWORD(class))
+ {
+ DWORD len = WideCharToMultiByte( CP_ACP, 0, info.className, -1, NULL, 0, NULL, NULL );
+ class = HeapAlloc( GetProcessHeap(), 0, len );
+ WideCharToMultiByte( CP_ACP, 0, info.className, -1, class, len, NULL, NULL );
+ }
+ if (HIWORD(caption))
+ {
+ DWORD len = WideCharToMultiByte( CP_ACP, 0, info.windowName, -1, NULL, 0, NULL, NULL );
+ caption = HeapAlloc( GetProcessHeap(), 0, len );
+ WideCharToMultiByte( CP_ACP, 0, info.windowName, -1, caption, len, NULL, NULL );
+ }
+ hwndCtrl = CreateWindowExA( info.exStyle | WS_EX_NOPARENTNOTIFY,
+ class, caption, info.style | WS_CHILD,
+ MulDiv(info.x, dlgInfo->xBaseUnit, 4),
+ MulDiv(info.y, dlgInfo->yBaseUnit, 8),
+ MulDiv(info.cx, dlgInfo->xBaseUnit, 4),
+ MulDiv(info.cy, dlgInfo->yBaseUnit, 8),
+ hwnd, (HMENU)info.id,
+ hInst, (LPVOID)info.data );
+ if (HIWORD(class)) HeapFree( GetProcessHeap(), 0, class );
+ if (HIWORD(caption)) HeapFree( GetProcessHeap(), 0, caption );
+ }
+ if (!hwndCtrl)
+ {
+ if (dlgTemplate->style & DS_NOFAILCREATE) continue;
+ return FALSE;
+ }
/* Send initialisation messages to the control */
if (dlgInfo->hUserFont) SendMessageA( hwndCtrl, WM_SETFONT,
@@ -519,8 +407,7 @@
/* If there's already a default push-button, set it back */
/* to normal and use this one instead. */
if (hwndDefButton)
- SendMessageA( hwndDefButton, BM_SETSTYLE,
- BS_PUSHBUTTON,FALSE );
+ SendMessageA( hwndDefButton, BM_SETSTYLE, BS_PUSHBUTTON, FALSE );
hwndDefButton = hwndCtrl;
dlgInfo->idResult = GetWindowLongA( hwndCtrl, GWL_ID );
}
@@ -531,76 +418,6 @@
/***********************************************************************
- * DIALOG_ParseTemplate16
- *
- * Fill a DLG_TEMPLATE structure from the dialog template, and return
- * a pointer to the first control.
- */
-static LPCSTR DIALOG_ParseTemplate16( LPCSTR p, DLG_TEMPLATE * result )
-{
- result->style = GET_DWORD(p); p += sizeof(DWORD);
- result->exStyle = 0;
- result->nbItems = (unsigned char) *p++;
- result->x = GET_WORD(p); p += sizeof(WORD);
- result->y = GET_WORD(p); p += sizeof(WORD);
- result->cx = GET_WORD(p); p += sizeof(WORD);
- result->cy = GET_WORD(p); p += sizeof(WORD);
- TRACE("DIALOG %d, %d, %d, %d\n",
- result->x, result->y, result->cx, result->cy );
- TRACE(" STYLE %08lx\n", result->style );
-
- /* Get the menu name */
-
- switch( (BYTE)*p )
- {
- case 0:
- result->menuName = 0;
- p++;
- break;
- case 0xff:
- result->menuName = (LPCSTR)(UINT)GET_WORD( p + 1 );
- p += 3;
- TRACE(" MENU %04x\n", LOWORD(result->menuName) );
- break;
- default:
- result->menuName = p;
- TRACE(" MENU '%s'\n", p );
- p += strlen(p) + 1;
- break;
- }
-
- /* Get the class name */
-
- if (*p)
- {
- result->className = p;
- TRACE(" CLASS '%s'\n", result->className );
- }
- else result->className = DIALOG_CLASS_ATOM;
- p += strlen(p) + 1;
-
- /* Get the window caption */
-
- result->caption = p;
- p += strlen(p) + 1;
- TRACE(" CAPTION '%s'\n", result->caption );
-
- /* Get the font name */
-
- if (result->style & DS_SETFONT)
- {
- result->pointSize = GET_WORD(p);
- p += sizeof(WORD);
- result->faceName = p;
- p += strlen(p) + 1;
- TRACE(" FONT %d,'%s'\n",
- result->pointSize, result->faceName );
- }
- return p;
-}
-
-
-/***********************************************************************
* DIALOG_ParseTemplate32
*
* Fill a DLG_TEMPLATE structure from the dialog template, and return
@@ -644,14 +461,14 @@
p++;
break;
case 0xffff:
- result->menuName = (LPCSTR)(UINT)GET_WORD( p + 1 );
+ result->menuName = (LPCWSTR)(UINT)GET_WORD( p + 1 );
p += 2;
TRACE(" MENU %04x\n", LOWORD(result->menuName) );
break;
default:
- result->menuName = (LPCSTR)p;
- TRACE(" MENU %s\n", debugstr_w( (LPCWSTR)p ));
- p += strlenW( (LPCWSTR)p ) + 1;
+ result->menuName = (LPCWSTR)p;
+ TRACE(" MENU %s\n", debugstr_w(result->menuName) );
+ p += strlenW( result->menuName ) + 1;
break;
}
@@ -660,26 +477,26 @@
switch(GET_WORD(p))
{
case 0x0000:
- result->className = DIALOG_CLASS_ATOM;
+ result->className = DIALOG_CLASS_ATOMW;
p++;
break;
case 0xffff:
- result->className = (LPCSTR)(UINT)GET_WORD( p + 1 );
+ result->className = (LPCWSTR)(UINT)GET_WORD( p + 1 );
p += 2;
TRACE(" CLASS %04x\n", LOWORD(result->className) );
break;
default:
- result->className = (LPCSTR)p;
- TRACE(" CLASS %s\n", debugstr_w( (LPCWSTR)p ));
- p += strlenW( (LPCWSTR)p ) + 1;
+ result->className = (LPCWSTR)p;
+ TRACE(" CLASS %s\n", debugstr_w( result->className ));
+ p += strlenW( result->className ) + 1;
break;
}
/* Get the window caption */
- result->caption = (LPCSTR)p;
- p += strlenW( (LPCWSTR)p ) + 1;
- TRACE(" CAPTION %s\n", debugstr_w( (LPCWSTR)result->caption ) );
+ result->caption = (LPCWSTR)p;
+ p += strlenW( result->caption ) + 1;
+ TRACE(" CAPTION %s\n", debugstr_w( result->caption ) );
/* Get the font name */
@@ -697,10 +514,10 @@
result->weight = FW_DONTCARE;
result->italic = FALSE;
}
- result->faceName = (LPCSTR)p;
- p += strlenW( (LPCWSTR)p ) + 1;
+ result->faceName = (LPCWSTR)p;
+ p += strlenW( result->faceName ) + 1;
TRACE(" FONT %d, %s, %d, %s\n",
- result->pointSize, debugstr_w( (LPCWSTR)result->faceName ),
+ result->pointSize, debugstr_w( result->faceName ),
result->weight, result->italic ? "TRUE" : "FALSE" );
}
@@ -719,7 +536,7 @@
*/
static HWND DIALOG_CreateIndirect( HINSTANCE hInst, LPCVOID dlgTemplate,
HWND owner, DLGPROC dlgProc, LPARAM param,
- WINDOWPROCTYPE procType, BOOL modal )
+ BOOL unicode, BOOL modal )
{
HWND hwnd;
RECT rect;
@@ -727,16 +544,11 @@
DLG_TEMPLATE template;
DIALOGINFO * dlgInfo;
BOOL ownerEnabled = TRUE;
- BOOL win32Template = (procType != WIN_PROC_16);
- BOOL res;
/* Parse dialog template */
if (!dlgTemplate) return 0;
- if (win32Template)
- dlgTemplate = DIALOG_ParseTemplate32( dlgTemplate, &template );
- else
- dlgTemplate = DIALOG_ParseTemplate16( dlgTemplate, &template );
+ dlgTemplate = DIALOG_ParseTemplate32( dlgTemplate, &template );
/* Initialise dialog extra data */
@@ -752,11 +564,7 @@
/* Load menu */
- if (template.menuName)
- {
- if (!win32Template) dlgInfo->hMenu = HMENU_32(LoadMenu16( HINSTANCE_16(hInst), template.menuName ));
- else dlgInfo->hMenu = LoadMenuW( hInst, (LPCWSTR)template.menuName );
- }
+ if (template.menuName) dlgInfo->hMenu = LoadMenuW( hInst, template.menuName );
/* Create custom font if needed */
@@ -769,15 +577,10 @@
dc = GetDC(0);
pixels = MulDiv(template.pointSize, GetDeviceCaps(dc , LOGPIXELSY), 72);
ReleaseDC(0, dc);
- if (win32Template)
- dlgInfo->hUserFont = CreateFontW( -pixels, 0, 0, 0, template.weight,
- template.italic, FALSE, FALSE, DEFAULT_CHARSET, 0, 0,
- PROOF_QUALITY, FF_DONTCARE,
- (LPCWSTR)template.faceName );
- else
- dlgInfo->hUserFont = CreateFontA( -pixels, 0, 0, 0, FW_DONTCARE,
- FALSE, FALSE, FALSE, DEFAULT_CHARSET, 0, 0,
- PROOF_QUALITY, FF_DONTCARE, template.faceName );
+ dlgInfo->hUserFont = CreateFontW( -pixels, 0, 0, 0, template.weight,
+ template.italic, FALSE, FALSE, DEFAULT_CHARSET, 0, 0,
+ PROOF_QUALITY, FF_DONTCARE,
+ template.faceName );
if (dlgInfo->hUserFont)
{
SIZE charSize;
@@ -801,9 +604,9 @@
rect.right -= rect.left;
rect.bottom -= rect.top;
- if ((INT16)template.x == CW_USEDEFAULT16)
+ if (template.x == CW_USEDEFAULT16)
{
- rect.left = rect.top = win32Template? CW_USEDEFAULT : CW_USEDEFAULT16;
+ rect.left = rect.top = CW_USEDEFAULT;
}
else
{
@@ -818,8 +621,8 @@
rect.top += MulDiv(template.y, dlgInfo->yBaseUnit, 8);
}
if ( !(template.style & WS_CHILD) )
- {
- INT16 dX, dY;
+ {
+ INT dX, dY;
if( !(template.style & DS_ABSALIGN) )
ClientToScreen( owner, (POINT *)&rect );
@@ -841,18 +644,37 @@
if (ownerEnabled) dlgInfo->flags |= DF_OWNERENABLED;
}
- if (!win32Template)
- hwnd = WIN_Handle32( CreateWindowEx16(template.exStyle, template.className,
- template.caption, template.style & ~WS_VISIBLE,
- rect.left, rect.top, rect.right, rect.bottom,
- HWND_16(owner), HMENU_16(dlgInfo->hMenu),
- HINSTANCE_16(hInst), NULL ));
+ if (unicode)
+ {
+ hwnd = CreateWindowExW(template.exStyle, template.className, template.caption,
+ template.style & ~WS_VISIBLE,
+ rect.left, rect.top, rect.right, rect.bottom,
+ owner, dlgInfo->hMenu, hInst, NULL );
+ }
else
- hwnd = CreateWindowExW(template.exStyle, (LPCWSTR)template.className,
- (LPCWSTR)template.caption,
- template.style & ~WS_VISIBLE,
- rect.left, rect.top, rect.right, rect.bottom,
- owner, dlgInfo->hMenu, hInst, NULL );
+ {
+ LPSTR class = (LPSTR)template.className;
+ LPSTR caption = (LPSTR)template.caption;
+
+ if (HIWORD(class))
+ {
+ DWORD len = WideCharToMultiByte( CP_ACP, 0, template.className, -1, NULL, 0, NULL, NULL );
+ class = HeapAlloc( GetProcessHeap(), 0, len );
+ WideCharToMultiByte( CP_ACP, 0, template.className, -1, class, len, NULL, NULL );
+ }
+ if (HIWORD(caption))
+ {
+ DWORD len = WideCharToMultiByte( CP_ACP, 0, template.caption, -1, NULL, 0, NULL, NULL );
+ caption = HeapAlloc( GetProcessHeap(), 0, len );
+ WideCharToMultiByte( CP_ACP, 0, template.caption, -1, caption, len, NULL, NULL );
+ }
+ hwnd = CreateWindowExA(template.exStyle, class, caption,
+ template.style & ~WS_VISIBLE,
+ rect.left, rect.top, rect.right, rect.bottom,
+ owner, dlgInfo->hMenu, hInst, NULL );
+ if (HIWORD(class)) HeapFree( GetProcessHeap(), 0, class );
+ if (HIWORD(caption)) HeapFree( GetProcessHeap(), 0, caption );
+ }
if (!hwnd)
{
@@ -868,25 +690,16 @@
if (template.helpId) SetWindowContextHelpId( hwnd, template.helpId );
SetWindowLongW( hwnd, DWL_WINE_DIALOGINFO, (LONG)dlgInfo );
- switch(procType)
- {
- case WIN_PROC_16: SetWindowLong16( HWND_16(hwnd), DWL_DLGPROC, (LONG)dlgProc ); break;
- case WIN_PROC_32A: SetWindowLongA( hwnd, DWL_DLGPROC, (LONG)dlgProc ); break;
- case WIN_PROC_32W: SetWindowLongW( hwnd, DWL_DLGPROC, (LONG)dlgProc ); break;
- default: break;
- }
+
+ if (unicode) SetWindowLongW( hwnd, DWL_DLGPROC, (LONG)dlgProc );
+ else SetWindowLongA( hwnd, DWL_DLGPROC, (LONG)dlgProc );
if (dlgInfo->hUserFont)
SendMessageA( hwnd, WM_SETFONT, (WPARAM)dlgInfo->hUserFont, 0 );
/* Create controls */
- if (win32Template)
- res = DIALOG_CreateControls32( hwnd, dlgTemplate, &template, hInst );
- else
- res = DIALOG_CreateControls16( hwnd, dlgTemplate, &template, HINSTANCE_16(hInst) );
-
- if (res)
+ if (DIALOG_CreateControls32( hwnd, dlgTemplate, &template, hInst, unicode ))
{
HWND hwndPreInitFocus;
@@ -929,130 +742,68 @@
/***********************************************************************
- * CreateDialog (USER.89)
- */
-HWND16 WINAPI CreateDialog16( HINSTANCE16 hInst, LPCSTR dlgTemplate,
- HWND16 owner, DLGPROC16 dlgProc )
-{
- return CreateDialogParam16( hInst, dlgTemplate, owner, dlgProc, 0 );
-}
-
-
-/***********************************************************************
- * CreateDialogParam (USER.241)
- */
-HWND16 WINAPI CreateDialogParam16( HINSTANCE16 hInst, LPCSTR dlgTemplate,
- HWND16 owner, DLGPROC16 dlgProc,
- LPARAM param )
-{
- HWND16 hwnd = 0;
- HRSRC16 hRsrc;
- HGLOBAL16 hmem;
- LPCVOID data;
-
- TRACE("%04x,%s,%04x,%08lx,%ld\n",
- hInst, debugstr_a(dlgTemplate), owner, (DWORD)dlgProc, param );
-
- if (!(hRsrc = FindResource16( hInst, dlgTemplate, RT_DIALOGA ))) return 0;
- if (!(hmem = LoadResource16( hInst, hRsrc ))) return 0;
- if (!(data = LockResource16( hmem ))) hwnd = 0;
- else hwnd = CreateDialogIndirectParam16( hInst, data, owner,
- dlgProc, param );
- FreeResource16( hmem );
- return hwnd;
-}
-
-/***********************************************************************
* CreateDialogParamA (USER32.@)
*/
-HWND WINAPI CreateDialogParamA( HINSTANCE hInst, LPCSTR name,
- HWND owner, DLGPROC dlgProc,
- LPARAM param )
+HWND WINAPI CreateDialogParamA( HINSTANCE hInst, LPCSTR name, HWND owner,
+ DLGPROC dlgProc, LPARAM param )
{
- HRSRC hrsrc = FindResourceA( hInst, name, RT_DIALOGA );
- if (!hrsrc) return 0;
- return CreateDialogIndirectParamA( hInst,
- (LPVOID)LoadResource(hInst, hrsrc),
- owner, dlgProc, param );
+ HRSRC hrsrc;
+ LPCDLGTEMPLATEA ptr;
+
+ if (!(hrsrc = FindResourceA( hInst, name, RT_DIALOGA ))) return 0;
+ if (!(ptr = (LPCDLGTEMPLATEA)LoadResource(hInst, hrsrc))) return 0;
+ return CreateDialogIndirectParamA( hInst, ptr, owner, dlgProc, param );
}
/***********************************************************************
* CreateDialogParamW (USER32.@)
*/
-HWND WINAPI CreateDialogParamW( HINSTANCE hInst, LPCWSTR name,
- HWND owner, DLGPROC dlgProc,
- LPARAM param )
+HWND WINAPI CreateDialogParamW( HINSTANCE hInst, LPCWSTR name, HWND owner,
+ DLGPROC dlgProc, LPARAM param )
{
- HRSRC hrsrc = FindResourceW( hInst, name, RT_DIALOGW );
- if (!hrsrc) return 0;
- return CreateDialogIndirectParamW( hInst,
- (LPVOID)LoadResource(hInst, hrsrc),
- owner, dlgProc, param );
+ HRSRC hrsrc;
+ LPCDLGTEMPLATEA ptr;
+
+ if (!(hrsrc = FindResourceW( hInst, name, RT_DIALOGW ))) return 0;
+ if (!(ptr = (LPCDLGTEMPLATEW)LoadResource(hInst, hrsrc))) return 0;
+ return CreateDialogIndirectParamW( hInst, ptr, owner, dlgProc, param );
}
/***********************************************************************
- * CreateDialogIndirect (USER.219)
- */
-HWND16 WINAPI CreateDialogIndirect16( HINSTANCE16 hInst, LPCVOID dlgTemplate,
- HWND16 owner, DLGPROC16 dlgProc )
-{
- return CreateDialogIndirectParam16( hInst, dlgTemplate, owner, dlgProc, 0);
-}
-
-
-/***********************************************************************
- * CreateDialogIndirectParam (USER.242)
- */
-HWND16 WINAPI CreateDialogIndirectParam16( HINSTANCE16 hInst,
- LPCVOID dlgTemplate,
- HWND16 owner, DLGPROC16 dlgProc,
- LPARAM param )
-{
- return HWND_16( DIALOG_CreateIndirect( HINSTANCE_32(hInst), dlgTemplate, WIN_Handle32(owner),
- (DLGPROC)dlgProc, param, WIN_PROC_16, FALSE ));
-}
-
-
-/***********************************************************************
- * CreateDialogIndirectParamA (USER32.@)
- */
-HWND WINAPI CreateDialogIndirectParamA( HINSTANCE hInst,
- LPCDLGTEMPLATEA dlgTemplate,
- HWND owner, DLGPROC dlgProc,
- LPARAM param )
-{
- return DIALOG_CreateIndirect( hInst, dlgTemplate, owner, dlgProc, param, WIN_PROC_32A, FALSE );
-}
-
-/***********************************************************************
* CreateDialogIndirectParamAorW (USER32.@)
*/
-HWND WINAPI CreateDialogIndirectParamAorW( HINSTANCE hInst,
- LPCVOID dlgTemplate,
- HWND owner, DLGPROC dlgProc,
- LPARAM param )
-{ FIXME("assume WIN_PROC_32W\n");
- return DIALOG_CreateIndirect( hInst, dlgTemplate, owner, dlgProc, param, WIN_PROC_32W, FALSE );
+HWND WINAPI CreateDialogIndirectParamAorW( HINSTANCE hInst, LPCVOID dlgTemplate,
+ HWND owner, DLGPROC dlgProc, LPARAM param,
+ DWORD flags )
+{
+ return DIALOG_CreateIndirect( hInst, dlgTemplate, owner, dlgProc, param, !flags, FALSE );
+}
+
+/***********************************************************************
+ * CreateDialogIndirectParamA (USER32.@)
+ */
+HWND WINAPI CreateDialogIndirectParamA( HINSTANCE hInst, LPCDLGTEMPLATEA dlgTemplate,
+ HWND owner, DLGPROC dlgProc, LPARAM param )
+{
+ return CreateDialogIndirectParamAorW( hInst, dlgTemplate, owner, dlgProc, param, 2 );
}
/***********************************************************************
* CreateDialogIndirectParamW (USER32.@)
*/
-HWND WINAPI CreateDialogIndirectParamW( HINSTANCE hInst,
- LPCDLGTEMPLATEW dlgTemplate,
- HWND owner, DLGPROC dlgProc,
- LPARAM param )
+HWND WINAPI CreateDialogIndirectParamW( HINSTANCE hInst, LPCDLGTEMPLATEW dlgTemplate,
+ HWND owner, DLGPROC dlgProc, LPARAM param )
{
- return DIALOG_CreateIndirect( hInst, dlgTemplate, owner, dlgProc, param, WIN_PROC_32W, FALSE );
+ return CreateDialogIndirectParamAorW( hInst, dlgTemplate, owner, dlgProc, param, 0 );
}
/***********************************************************************
* DIALOG_DoDialogBox
*/
-static INT DIALOG_DoDialogBox( HWND hwnd, HWND owner )
+INT DIALOG_DoDialogBox( HWND hwnd, HWND owner )
{
DIALOGINFO * dlgInfo;
MSG msg;
@@ -1094,53 +845,18 @@
/***********************************************************************
- * DialogBox (USER.87)
- */
-INT16 WINAPI DialogBox16( HINSTANCE16 hInst, LPCSTR dlgTemplate,
- HWND16 owner, DLGPROC16 dlgProc )
-{
- return DialogBoxParam16( hInst, dlgTemplate, owner, dlgProc, 0 );
-}
-
-
-/***********************************************************************
- * DialogBoxParam (USER.239)
- */
-INT16 WINAPI DialogBoxParam16( HINSTANCE16 hInst, LPCSTR template,
- HWND16 owner16, DLGPROC16 dlgProc, LPARAM param )
-{
- HWND hwnd = 0;
- HRSRC16 hRsrc;
- HGLOBAL16 hmem;
- LPCVOID data;
- int ret = -1;
-
- if (!(hRsrc = FindResource16( hInst, template, RT_DIALOGA ))) return 0;
- if (!(hmem = LoadResource16( hInst, hRsrc ))) return 0;
- if ((data = LockResource16( hmem )))
- {
- HWND owner = WIN_Handle32(owner16);
- hwnd = DIALOG_CreateIndirect( HINSTANCE_32(hInst), data, owner,
- (DLGPROC)dlgProc, param, WIN_PROC_16, TRUE );
- if (hwnd) ret = DIALOG_DoDialogBox( hwnd, owner );
- GlobalUnlock16( hmem );
- }
- FreeResource16( hmem );
- return ret;
-}
-
-
-/***********************************************************************
* DialogBoxParamA (USER32.@)
*/
INT_PTR WINAPI DialogBoxParamA( HINSTANCE hInst, LPCSTR name,
HWND owner, DLGPROC dlgProc, LPARAM param )
{
HWND hwnd;
- HRSRC hrsrc = FindResourceA( hInst, name, RT_DIALOGA );
- if (!hrsrc) return 0;
- hwnd = DIALOG_CreateIndirect( hInst, (LPVOID)LoadResource(hInst, hrsrc),
- owner, dlgProc, param, WIN_PROC_32A, TRUE );
+ HRSRC hrsrc;
+ LPCDLGTEMPLATEA ptr;
+
+ if (!(hrsrc = FindResourceA( hInst, name, RT_DIALOGA ))) return 0;
+ if (!(ptr = (LPCDLGTEMPLATEA)LoadResource(hInst, hrsrc))) return 0;
+ hwnd = DIALOG_CreateIndirect( hInst, ptr, owner, dlgProc, param, FALSE, TRUE );
if (hwnd) return DIALOG_DoDialogBox( hwnd, owner );
return -1;
}
@@ -1153,55 +869,36 @@
HWND owner, DLGPROC dlgProc, LPARAM param )
{
HWND hwnd;
- HRSRC hrsrc = FindResourceW( hInst, name, RT_DIALOGW );
- if (!hrsrc) return 0;
- hwnd = DIALOG_CreateIndirect( hInst, (LPVOID)LoadResource(hInst, hrsrc),
- owner, dlgProc, param, WIN_PROC_32W, TRUE );
+ HRSRC hrsrc;
+ LPCDLGTEMPLATEW ptr;
+
+ if (!(hrsrc = FindResourceW( hInst, name, RT_DIALOGW ))) return 0;
+ if (!(ptr = (LPCDLGTEMPLATEW)LoadResource(hInst, hrsrc))) return 0;
+ hwnd = DIALOG_CreateIndirect( hInst, ptr, owner, dlgProc, param, TRUE, TRUE );
if (hwnd) return DIALOG_DoDialogBox( hwnd, owner );
return -1;
}
/***********************************************************************
- * DialogBoxIndirect (USER.218)
+ * DialogBoxIndirectParamAorW (USER32.@)
*/
-INT16 WINAPI DialogBoxIndirect16( HINSTANCE16 hInst, HANDLE16 dlgTemplate,
- HWND16 owner, DLGPROC16 dlgProc )
+INT_PTR WINAPI DialogBoxIndirectParamAorW( HINSTANCE hInstance, LPCVOID template,
+ HWND owner, DLGPROC dlgProc,
+ LPARAM param, DWORD flags )
{
- return DialogBoxIndirectParam16( hInst, dlgTemplate, owner, dlgProc, 0 );
-}
-
-
-/***********************************************************************
- * DialogBoxIndirectParam (USER.240)
- */
-INT16 WINAPI DialogBoxIndirectParam16( HINSTANCE16 hInst, HANDLE16 dlgTemplate,
- HWND16 owner16, DLGPROC16 dlgProc,
- LPARAM param )
-{
- HWND hwnd, owner = WIN_Handle32( owner16 );
- LPCVOID ptr;
-
- if (!(ptr = GlobalLock16( dlgTemplate ))) return -1;
- hwnd = DIALOG_CreateIndirect( HINSTANCE_32(hInst), ptr, owner, (DLGPROC)dlgProc,
- param, WIN_PROC_16, TRUE );
- GlobalUnlock16( dlgTemplate );
+ HWND hwnd = DIALOG_CreateIndirect( hInstance, template, owner, dlgProc, param, !flags, TRUE );
if (hwnd) return DIALOG_DoDialogBox( hwnd, owner );
return -1;
}
-
/***********************************************************************
* DialogBoxIndirectParamA (USER32.@)
*/
INT_PTR WINAPI DialogBoxIndirectParamA(HINSTANCE hInstance, LPCDLGTEMPLATEA template,
- HWND owner, DLGPROC dlgProc,
- LPARAM param )
+ HWND owner, DLGPROC dlgProc, LPARAM param )
{
- HWND hwnd = DIALOG_CreateIndirect( hInstance, template, owner,
- dlgProc, param, WIN_PROC_32A, TRUE );
- if (hwnd) return DIALOG_DoDialogBox( hwnd, owner );
- return -1;
+ return DialogBoxIndirectParamAorW( hInstance, template, owner, dlgProc, param, 2 );
}
@@ -1209,28 +906,9 @@
* DialogBoxIndirectParamW (USER32.@)
*/
INT_PTR WINAPI DialogBoxIndirectParamW(HINSTANCE hInstance, LPCDLGTEMPLATEW template,
- HWND owner, DLGPROC dlgProc,
- LPARAM param )
+ HWND owner, DLGPROC dlgProc, LPARAM param )
{
- HWND hwnd = DIALOG_CreateIndirect( hInstance, template, owner,
- dlgProc, param, WIN_PROC_32W, TRUE );
- if (hwnd) return DIALOG_DoDialogBox( hwnd, owner );
- return -1;
-}
-
-/***********************************************************************
- * DialogBoxIndirectParamAorW (USER32.@)
- */
-INT_PTR WINAPI DialogBoxIndirectParamAorW(HINSTANCE hInstance, LPCVOID template,
- HWND owner, DLGPROC dlgProc,
- LPARAM param, DWORD x )
-{
- HWND hwnd;
- FIXME("%p %p %p %p 0x%08lx 0x%08lx\n",
- hInstance, template, owner, dlgProc, param, x);
- hwnd = DIALOG_CreateIndirect( hInstance, template, owner, dlgProc, param, WIN_PROC_32W, TRUE );
- if (hwnd) return DIALOG_DoDialogBox( hwnd, owner );
- return -1;
+ return DialogBoxIndirectParamAorW( hInstance, template, owner, dlgProc, param, 0 );
}
/***********************************************************************