Commit 2429ef90 authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

user32: Dialog creation code should force WS_CHILD style for dialog controls.

parent 50d37fe0
......@@ -263,7 +263,9 @@ static BOOL DIALOG_CreateControls32( HWND hwnd, LPCSTR template, const DLG_TEMPL
{
template = (LPCSTR)DIALOG_GetControl32( (const WORD *)template, &info,
dlgTemplate->dialogEx );
/* Is this it? */
info.style &= ~WS_POPUP;
info.style |= WS_CHILD;
if (info.style & WS_BORDER)
{
info.style &= ~WS_BORDER;
......
......@@ -33,6 +33,8 @@
#include <stdio.h>
#include <stdarg.h>
#define WINVER 0x0600 /* For NONCLIENTMETRICS with padding */
#include "wine/test.h"
#include "windef.h"
#include "winbase.h"
......@@ -1058,11 +1060,50 @@ static INT_PTR CALLBACK TestReturnKeyDlgProc (HWND hDlg, UINT uiMsg,
return FALSE;
}
static INT_PTR CALLBACK TestControlStyleDlgProc(HWND hdlg, UINT msg,
WPARAM wparam, LPARAM lparam)
{
HWND control;
DWORD style, exstyle;
char buf[256];
switch (msg)
{
case WM_INITDIALOG:
control = GetDlgItem(hdlg, 7);
ok(control != 0, "dialog control with id 7 not found\n");
style = GetWindowLong(control, GWL_STYLE);
ok(style == (WS_CHILD|WS_VISIBLE), "expected WS_CHILD|WS_VISIBLE, got %#x\n", style);
exstyle = GetWindowLong(control, GWL_EXSTYLE);
ok(exstyle == (WS_EX_NOPARENTNOTIFY|WS_EX_TRANSPARENT|WS_EX_CLIENTEDGE), "expected WS_EX_NOPARENTNOTIFY|WS_EX_TRANSPARENT|WS_EX_CLIENTEDGE, got %#x\n", exstyle);
buf[0] = 0;
GetWindowText(control, buf, sizeof(buf));
ok(lstrcmp(buf, "bump7") == 0, "expected bump7, got %s\n", buf);
control = GetDlgItem(hdlg, 8);
ok(control != 0, "dialog control with id 8 not found\n");
style = GetWindowLong(control, GWL_STYLE);
ok(style == (WS_CHILD|WS_VISIBLE), "expected WS_CHILD|WS_VISIBLE, got %#x\n", style);
exstyle = GetWindowLong(control, GWL_EXSTYLE);
ok(exstyle == (WS_EX_NOPARENTNOTIFY|WS_EX_TRANSPARENT), "expected WS_EX_NOPARENTNOTIFY|WS_EX_TRANSPARENT, got %#x\n", exstyle);
buf[0] = 0;
GetWindowText(control, buf, sizeof(buf));
ok(lstrcmp(buf, "bump8") == 0, "expected bump8, got %s\n", buf);
EndDialog(hdlg, -7);
return TRUE;
}
return FALSE;
}
static void test_DialogBoxParamA(void)
{
INT_PTR ret;
HWND hwnd_invalid = (HWND)0x4444;
ret = DialogBoxParamA(GetModuleHandle(0), "TEST_DLG_CHILD_POPUP", 0, TestControlStyleDlgProc, 0);
ok(ret == -7, "expected -7, got %ld\n", ret);
SetLastError(0xdeadbeef);
ret = DialogBoxParamA(GetModuleHandle(NULL), "IDD_DIALOG" , hwnd_invalid, 0 , 0);
ok(0 == ret || broken(ret == -1), "DialogBoxParamA returned %ld, expected 0\n", ret);
......
......@@ -45,6 +45,16 @@ STRINGTABLE
65534 "Test high id"
}
/* Test dialog with a mixed style WS_CHILD | WS_POPUP control */
TEST_DLG_CHILD_POPUP DIALOG 0, 0, 60, 30
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Test dialog with mixed style controls"
FONT 8, "MS Shell Dlg"
{
CONTROL "bump7",7,"static",WS_CHILD|WS_POPUP|WS_BORDER,0,0,40,10,WS_EX_TRANSPARENT
CONTROL "bump8",8,"static",WS_POPUP,0,10,40,10,WS_EX_TRANSPARENT
}
TEST_DIALOG DIALOG 0, 0, 60, 30
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE
CAPTION "Test dialog"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment