Skip to content
Snippets Groups Projects
Commit dc70553c authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard
Browse files

Merge the MDI and common window creation code. Change the way MDI

children are managed in MDIClient.
Add support for MDICREATESTRUCT A<->W conversions.
Add support for WM_MDIREFRESHMENU.
parent 52bf6c2b
No related branches found
No related tags found
No related merge requests found
......@@ -696,34 +696,180 @@ static void test_MDI_create(HWND parent, HWND mdi_client)
{
MDICREATESTRUCTA mdi_cs;
HWND mdi_child;
static const WCHAR classW[] = {'M','D','I','_','c','h','i','l','d','_','C','l','a','s','s','_','1',0};
static const WCHAR titleW[] = {'M','D','I',' ','c','h','i','l','d',0};
BOOL isWin9x = FALSE;
mdi_cs.szClass = "MDI_child_Class_1";
mdi_cs.szTitle = "MDI child 1";
mdi_cs.szTitle = "MDI child";
mdi_cs.hOwner = GetModuleHandle(0);
mdi_cs.x = 0;
mdi_cs.y = 0;
mdi_cs.x = CW_USEDEFAULT;
mdi_cs.y = CW_USEDEFAULT;
mdi_cs.cx = CW_USEDEFAULT;
mdi_cs.cy = CW_USEDEFAULT;
mdi_cs.style = WS_CAPTION | WS_CHILD /*| WS_VISIBLE*/;
mdi_cs.style = 0;
mdi_cs.lParam = (LPARAM)mdi_lParam_test_message;
mdi_child = (HWND)SendMessageA(mdi_client, WM_MDICREATE, 0, (LPARAM)&mdi_cs);
assert(mdi_child);
ok(mdi_child != 0, "MDI child creation failed\n");
DestroyWindow(mdi_child);
mdi_child = CreateMDIWindowA("MDI_child_Class_1", "MDI child 2",
WS_CAPTION | WS_CHILD /*| WS_VISIBLE*/,
10, 10, CW_USEDEFAULT, CW_USEDEFAULT,
mdi_cs.style = 0x7fffffff; /* without WS_POPUP */
mdi_child = (HWND)SendMessageA(mdi_client, WM_MDICREATE, 0, (LPARAM)&mdi_cs);
ok(mdi_child != 0, "MDI child creation failed\n");
DestroyWindow(mdi_child);
mdi_cs.style = 0xffffffff; /* with WS_POPUP */
mdi_child = (HWND)SendMessageA(mdi_client, WM_MDICREATE, 0, (LPARAM)&mdi_cs);
if (GetWindowLongA(mdi_client, GWL_STYLE) & MDIS_ALLCHILDSTYLES)
{
ok(!mdi_child, "MDI child with WS_POPUP and with MDIS_ALLCHILDSTYLES should fail\n");
DestroyWindow(mdi_child);
}
else
ok(mdi_child != 0, "MDI child creation failed\n");
/* test MDICREATESTRUCT A<->W mapping */
/* MDICREATESTRUCTA and MDICREATESTRUCTW have the same layout */
mdi_cs.style = 0;
mdi_cs.szClass = (LPCSTR)classW;
mdi_cs.szTitle = (LPCSTR)titleW;
SetLastError(0xdeadbeef);
mdi_child = (HWND)SendMessageW(mdi_client, WM_MDICREATE, 0, (LPARAM)&mdi_cs);
if (!mdi_child)
{
if (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
isWin9x = TRUE;
else
ok(mdi_child != 0, "MDI child creation failed\n");
}
DestroyWindow(mdi_child);
mdi_child = CreateMDIWindowA("MDI_child_Class_1", "MDI child",
0,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
mdi_client, GetModuleHandle(0),
(LPARAM)mdi_lParam_test_message);
ok(mdi_child != 0, "MDI child creation failed\n");
DestroyWindow(mdi_child);
mdi_child = CreateMDIWindowA("MDI_child_Class_1", "MDI child",
0x7fffffff, /* without WS_POPUP */
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
mdi_client, GetModuleHandle(0),
(LPARAM)mdi_lParam_test_message);
assert(mdi_child);
ok(mdi_child != 0, "MDI child creation failed\n");
DestroyWindow(mdi_child);
mdi_child = CreateWindowExA(0, "MDI_child_Class_2", "MDI child 3",
WS_CAPTION | WS_CHILD /*| WS_VISIBLE*/,
20, 20, CW_USEDEFAULT, CW_USEDEFAULT,
mdi_child = CreateMDIWindowA("MDI_child_Class_1", "MDI child",
0xffffffff, /* with WS_POPUP */
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
mdi_client, GetModuleHandle(0),
(LPARAM)mdi_lParam_test_message);
if (GetWindowLongA(mdi_client, GWL_STYLE) & MDIS_ALLCHILDSTYLES)
{
ok(!mdi_child, "MDI child with WS_POPUP and with MDIS_ALLCHILDSTYLES should fail\n");
DestroyWindow(mdi_child);
}
else
ok(mdi_child != 0, "MDI child creation failed\n");
/* test MDICREATESTRUCT A<->W mapping */
SetLastError(0xdeadbeef);
mdi_child = CreateMDIWindowW(classW, titleW,
0,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
mdi_client, GetModuleHandle(0),
(LPARAM)mdi_lParam_test_message);
if (!mdi_child)
{
if (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
isWin9x = TRUE;
else
ok(mdi_child != 0, "MDI child creation failed\n");
}
DestroyWindow(mdi_child);
mdi_child = CreateWindowExA(WS_EX_MDICHILD, "MDI_child_Class_1", "MDI child",
0,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
mdi_client, 0, GetModuleHandle(0),
(LPVOID)mdi_lParam_test_message);
ok(mdi_child != 0, "MDI child creation failed\n");
DestroyWindow(mdi_child);
mdi_child = CreateWindowExA(WS_EX_MDICHILD, "MDI_child_Class_1", "MDI child",
0x7fffffff, /* without WS_POPUP */
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
mdi_client, 0, GetModuleHandle(0),
(LPVOID)mdi_lParam_test_message);
assert(mdi_child);
ok(mdi_child != 0, "MDI child creation failed\n");
DestroyWindow(mdi_child);
mdi_child = CreateWindowExA(WS_EX_MDICHILD, "MDI_child_Class_1", "MDI child",
0xffffffff, /* with WS_POPUP */
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
mdi_client, 0, GetModuleHandle(0),
(LPVOID)mdi_lParam_test_message);
if (GetWindowLongA(mdi_client, GWL_STYLE) & MDIS_ALLCHILDSTYLES)
{
ok(!mdi_child, "MDI child with WS_POPUP and with MDIS_ALLCHILDSTYLES should fail\n");
DestroyWindow(mdi_child);
}
else
ok(mdi_child != 0, "MDI child creation failed\n");
/* test MDICREATESTRUCT A<->W mapping */
SetLastError(0xdeadbeef);
mdi_child = CreateWindowExW(WS_EX_MDICHILD, classW, titleW,
0,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
mdi_client, 0, GetModuleHandle(0),
(LPVOID)mdi_lParam_test_message);
if (!mdi_child)
{
if (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
isWin9x = TRUE;
else
ok(mdi_child != 0, "MDI child creation failed\n");
}
DestroyWindow(mdi_child);
/* This test fails on Win9x */
if (!isWin9x)
{
mdi_child = CreateWindowExA(WS_EX_MDICHILD, "MDI_child_Class_2", "MDI child",
WS_CHILD,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
parent, 0, GetModuleHandle(0),
(LPVOID)mdi_lParam_test_message);
ok(!mdi_child, "WS_EX_MDICHILD with a not MDIClient parent should fail\n");
}
mdi_child = CreateWindowExA(0, "MDI_child_Class_2", "MDI child",
WS_CHILD, /* without WS_POPUP */
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
mdi_client, 0, GetModuleHandle(0),
(LPVOID)mdi_lParam_test_message);
ok(mdi_child != 0, "MDI child creation failed\n");
DestroyWindow(mdi_child);
mdi_child = CreateWindowExA(0, "MDI_child_Class_2", "MDI child",
WS_CHILD | WS_POPUP, /* with WS_POPUP */
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
mdi_client, 0, GetModuleHandle(0),
(LPVOID)mdi_lParam_test_message);
ok(mdi_child != 0, "MDI child creation failed\n");
DestroyWindow(mdi_child);
}
......@@ -731,16 +877,53 @@ static LRESULT WINAPI mdi_child_wnd_proc_1(HWND hwnd, UINT msg, WPARAM wparam, L
{
switch (msg)
{
case WM_NCCREATE:
case WM_CREATE:
{
CREATESTRUCTA *cs = (CREATESTRUCTA *)lparam;
MDICREATESTRUCTA *mdi_cs = (MDICREATESTRUCTA *)cs->lpCreateParams;
todo_wine /* apparently Windows has a common code for MDI and other windows */
{
ok(cs->dwExStyle & WS_EX_MDICHILD, "WS_EX_MDICHILD should be set\n");
}
ok(mdi_cs->lParam == (LPARAM)mdi_lParam_test_message, "wrong mdi_cs->lParam\n");
ok(!lstrcmpA(cs->lpszClass, "MDI_child_Class_1"), "wrong class name\n");
ok(!lstrcmpA(cs->lpszClass, mdi_cs->szClass), "class name does not match\n");
ok(!lstrcmpA(cs->lpszName, "MDI child"), "wrong title\n");
ok(!lstrcmpA(cs->lpszName, mdi_cs->szTitle), "title does not match\n");
ok(cs->hInstance == mdi_cs->hOwner, "%p != %p\n", cs->hInstance, mdi_cs->hOwner);
/* MDICREATESTRUCT should have original values */
ok(mdi_cs->style == 0 || mdi_cs->style == 0x7fffffff || mdi_cs->style == 0xffffffff,
"mdi_cs->style does not match (%08lx)\n", mdi_cs->style);
ok(mdi_cs->x == CW_USEDEFAULT, "%d != CW_USEDEFAULT\n", mdi_cs->x);
ok(mdi_cs->y == CW_USEDEFAULT, "%d != CW_USEDEFAULT\n", mdi_cs->y);
ok(mdi_cs->cx == CW_USEDEFAULT, "%d != CW_USEDEFAULT\n", mdi_cs->cx);
ok(mdi_cs->cy == CW_USEDEFAULT, "%d != CW_USEDEFAULT\n", mdi_cs->cy);
/* CREATESTRUCT should have fixed values */
ok(cs->x != CW_USEDEFAULT, "%d == CW_USEDEFAULT\n", cs->x);
ok(cs->y != CW_USEDEFAULT, "%d == CW_USEDEFAULT\n", cs->y);
/* cx/cy == CW_USEDEFAULT are translated to NOT zero values */
ok(cs->cx != CW_USEDEFAULT && cs->cx != 0, "%d == CW_USEDEFAULT\n", cs->cx);
ok(cs->cy != CW_USEDEFAULT && cs->cy != 0, "%d == CW_USEDEFAULT\n", cs->cy);
ok(!(cs->style & WS_POPUP), "WS_POPUP is not allowed\n");
if (GetWindowLongA(cs->hwndParent, GWL_STYLE) & MDIS_ALLCHILDSTYLES)
{
ok(cs->style == (mdi_cs->style | WS_CHILD | WS_CLIPSIBLINGS),
"cs->style does not match (%08lx)\n", cs->style);
}
else
{
DWORD style = mdi_cs->style;
style &= ~WS_POPUP;
style |= WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CAPTION |
WS_SYSMENU | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX;
ok(cs->style == style,
"cs->style does not match (%08lx)\n", cs->style);
}
break;
}
}
......@@ -751,12 +934,26 @@ static LRESULT WINAPI mdi_child_wnd_proc_2(HWND hwnd, UINT msg, WPARAM wparam, L
{
switch (msg)
{
case WM_NCCREATE:
case WM_CREATE:
{
CREATESTRUCTA *cs = (CREATESTRUCTA *)lparam;
ok(!(cs->dwExStyle & WS_EX_MDICHILD), "WS_EX_MDICHILD should not be set\n");
ok(cs->lpCreateParams == mdi_lParam_test_message, "wrong cs->lpCreateParams\n");
ok(!lstrcmpA(cs->lpszClass, "MDI_child_Class_2"), "wrong class name\n");
ok(!lstrcmpA(cs->lpszName, "MDI child"), "wrong title\n");
/* CREATESTRUCT should have fixed values */
/* For some reason Win9x doesn't translate cs->x from CW_USEDEFAULT,
while NT does. */
/*ok(cs->x != CW_USEDEFAULT, "%d == CW_USEDEFAULT\n", cs->x);*/
ok(cs->y != CW_USEDEFAULT, "%d == CW_USEDEFAULT\n", cs->y);
/* cx/cy == CW_USEDEFAULT are translated to 0 */
ok(cs->cx == 0, "%d != 0\n", cs->cx);
ok(cs->cy == 0, "%d != 0\n", cs->cy);
break;
}
}
......@@ -779,15 +976,29 @@ static LRESULT WINAPI mdi_main_wnd_procA(HWND hwnd, UINT msg, WPARAM wparam, LPA
client_cs.hWindowMenu = 0;
client_cs.idFirstChild = 1;
/* MDIClient without MDIS_ALLCHILDSTYLES */
mdi_client = CreateWindowExA(0, "mdiclient",
NULL,
WS_CHILD | WS_CLIPCHILDREN /*| WS_VISIBLE*/,
WS_CHILD /*| WS_VISIBLE*/,
/* tests depend on a not zero MDIClient size */
0, 0, rc.right, rc.bottom,
hwnd, 0, GetModuleHandle(0),
(LPVOID)&client_cs);
assert(mdi_client);
test_MDI_create(hwnd, mdi_client);
DestroyWindow(mdi_client);
/* MDIClient with MDIS_ALLCHILDSTYLES */
mdi_client = CreateWindowExA(0, "mdiclient",
NULL,
WS_CHILD | MDIS_ALLCHILDSTYLES /*| WS_VISIBLE*/,
/* tests depend on a not zero MDIClient size */
0, 0, rc.right, rc.bottom,
hwnd, 0, GetModuleHandle(0),
(LPVOID)&client_cs);
assert(mdi_client);
test_MDI_create(hwnd, mdi_client);
DestroyWindow(mdi_client);
break;
}
......@@ -890,20 +1101,23 @@ static void test_icons(void)
res = (HICON)SendMessageA( hwnd, WM_GETICON, ICON_SMALL, 0 );
ok( res == 0, "wrong small icon %p/0\n", res );
res = (HICON)SendMessageA( hwnd, WM_GETICON, ICON_SMALL2, 0 );
ok( res != 0, "wrong small icon %p\n", res );
/* this test is XP specific */
/*res = (HICON)SendMessageA( hwnd, WM_GETICON, ICON_SMALL2, 0 );
ok( res != 0, "wrong small icon %p\n", res );*/
res = (HICON)SendMessageA( hwnd, WM_SETICON, ICON_SMALL, (LPARAM)icon );
ok( res == 0, "wrong previous small icon %p/0\n", res );
res = (HICON)SendMessageA( hwnd, WM_GETICON, ICON_SMALL, 0 );
ok( res == icon, "wrong small icon after set %p/%p\n", res, icon );
res = (HICON)SendMessageA( hwnd, WM_GETICON, ICON_SMALL2, 0 );
ok( res == icon, "wrong small icon after set %p/%p\n", res, icon );
/* this test is XP specific */
/*res = (HICON)SendMessageA( hwnd, WM_GETICON, ICON_SMALL2, 0 );
ok( res == icon, "wrong small icon after set %p/%p\n", res, icon );*/
res = (HICON)SendMessageA( hwnd, WM_SETICON, ICON_SMALL, (LPARAM)small_icon );
ok( res == icon, "wrong previous small icon %p/%p\n", res, icon );
res = (HICON)SendMessageA( hwnd, WM_GETICON, ICON_SMALL, 0 );
ok( res == small_icon, "wrong small icon after set %p/%p\n", res, small_icon );
res = (HICON)SendMessageA( hwnd, WM_GETICON, ICON_SMALL2, 0 );
ok( res == small_icon, "wrong small icon after set %p/%p\n", res, small_icon );
/* this test is XP specific */
/*res = (HICON)SendMessageA( hwnd, WM_GETICON, ICON_SMALL2, 0 );
ok( res == small_icon, "wrong small icon after set %p/%p\n", res, small_icon );*/
/* make sure the big icon hasn't changed */
res = (HICON)SendMessageA( hwnd, WM_GETICON, ICON_BIG, 0 );
......
......@@ -86,6 +86,7 @@ typedef struct
#define WIN_INTERNAL_PAINT 0x0010 /* Internal WM_PAINT message pending */
#define WIN_NEED_SIZE 0x0040 /* Internal WM_SIZE is needed */
#define WIN_NCACTIVATED 0x0080 /* last WM_NCACTIVATE was positive */
#define WIN_ISMDICLIENT 0x0100 /* Window is an MDIClient */
#define WIN_ISDIALOG 0x0200 /* Window is a dialog */
#define WIN_ISWIN32 0x0400 /* Understands Win32 messages */
#define WIN_NEEDS_SHOW_OWNEDPOPUP 0x0800 /* WM_SHOWWINDOW:SC_SHOW must be sent in the next ShowOwnedPopup call */
......@@ -114,6 +115,7 @@ extern BOOL WIN_IsWindowDrawable( HWND hwnd, BOOL );
extern HWND *WIN_ListParents( HWND hwnd );
extern HWND *WIN_ListChildren( HWND hwnd );
extern BOOL WIN_InternalShowOwnedPopups( HWND owner, BOOL fShow, BOOL unmanagedOnly );
extern void MDI_CalcDefaultChildPos( HWND hwndClient, INT total, LPPOINT lpPos, INT delta );
inline static HWND WIN_GetFullHandle( HWND hwnd )
{
......
This diff is collapsed.
......@@ -805,8 +805,29 @@ static void WIN_FixCoordinates( CREATESTRUCTA *cs, INT *sw)
{
if (cs->style & (WS_CHILD | WS_POPUP))
{
if (cs->x == CW_USEDEFAULT || cs->x == CW_USEDEFAULT16) cs->x = cs->y = 0;
if (cs->cx == CW_USEDEFAULT || cs->cx == CW_USEDEFAULT16) cs->cx = cs->cy = 0;
if (cs->dwExStyle & WS_EX_MDICHILD)
{
POINT pos[2];
MDI_CalcDefaultChildPos(cs->hwndParent, -1, pos, 0);
if (cs->x == CW_USEDEFAULT || cs->x == CW_USEDEFAULT16)
{
cs->x = pos[0].x;
cs->y = pos[0].y;
}
if (cs->cx == CW_USEDEFAULT || cs->cx == CW_USEDEFAULT16 || !cs->cx)
cs->cx = pos[1].x;
if (cs->cy == CW_USEDEFAULT || cs->cy == CW_USEDEFAULT16 || !cs->cy)
cs->cy = pos[1].y;
}
else
{
if (cs->x == CW_USEDEFAULT || cs->x == CW_USEDEFAULT16)
cs->x = cs->y = 0;
if (cs->cx == CW_USEDEFAULT || cs->cx == CW_USEDEFAULT16)
cs->cx = cs->cy = 0;
}
}
else /* overlapped window */
{
......@@ -979,7 +1000,7 @@ static HWND WIN_CreateWindowEx( CREATESTRUCTA *cs, ATOM classAtom,
{
INT sw = SW_SHOW;
WND *wndPtr;
HWND hwnd, parent, owner;
HWND hwnd, parent, owner, top_child = 0;
BOOL unicode = (type == WIN_PROC_32W);
TRACE("%s %s ex=%08lx style=%08lx %d,%d %dx%d parent=%p menu=%p inst=%p params=%p\n",
......@@ -993,6 +1014,62 @@ static HWND WIN_CreateWindowEx( CREATESTRUCTA *cs, ATOM classAtom,
TRACE("winproc type is %d (%s)\n", type, (type == WIN_PROC_16) ? "WIN_PROC_16" :
((type == WIN_PROC_32A) ? "WIN_PROC_32A" : "WIN_PROC_32W") );
/* Fix the styles for MDI children */
if (cs->dwExStyle & WS_EX_MDICHILD)
{
MDICREATESTRUCTA mdi_cs;
UINT flags = 0;
wndPtr = WIN_GetPtr(cs->hwndParent);
if (wndPtr && wndPtr != WND_OTHER_PROCESS)
{
flags = wndPtr->flags;
WIN_ReleasePtr(wndPtr);
}
if (!(flags & WIN_ISMDICLIENT))
{
WARN("WS_EX_MDICHILD, but parent %p is not MDIClient\n", cs->hwndParent);
return 0;
}
/* cs->lpCreateParams of WM_[NC]CREATE is different for MDI children.
* MDICREATESTRUCT members have the originally passed values.
*
* Note: we rely on the fact that MDICREATESTRUCTA and MDICREATESTRUCTW
* have the same layout.
*/
mdi_cs.szClass = cs->lpszClass;
mdi_cs.szTitle = cs->lpszName;
mdi_cs.hOwner = cs->hInstance;
mdi_cs.x = cs->x;
mdi_cs.y = cs->y;
mdi_cs.cx = cs->cx;
mdi_cs.cy = cs->cy;
mdi_cs.style = cs->style;
mdi_cs.lParam = (LPARAM)cs->lpCreateParams;
cs->lpCreateParams = (LPVOID)&mdi_cs;
if (GetWindowLongW(cs->hwndParent, GWL_STYLE) & MDIS_ALLCHILDSTYLES)
{
if (cs->style & WS_POPUP)
{
TRACE("WS_POPUP with MDIS_ALLCHILDSTYLES is not allowed\n");
return 0;
}
cs->style |= WS_CHILD | WS_CLIPSIBLINGS;
}
else
{
cs->style &= ~WS_POPUP;
cs->style |= WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CAPTION |
WS_SYSMENU | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX;
}
top_child = GetWindow(cs->hwndParent, GW_CHILD);
}
/* Find the parent window */
parent = GetDesktopWindow();
......@@ -1136,6 +1213,21 @@ static HWND WIN_CreateWindowEx( CREATESTRUCTA *cs, ATOM classAtom,
send_parent_notify( hwnd, WM_CREATE );
if (!IsWindow( hwnd )) return 0;
if (cs->dwExStyle & WS_EX_MDICHILD)
{
if (top_child)
{
/* Restore current maximized child */
if((cs->style & WS_VISIBLE) && IsZoomed(top_child))
{
TRACE("Restoring current maximized child %p\n", top_child);
ShowWindow(top_child, SW_SHOWNOACTIVATE);
}
}
SendMessageW(cs->hwndParent, WM_MDIREFRESHMENU, 0, 0);
}
if (cs->style & WS_VISIBLE)
{
/* in case WS_VISIBLE got set in the meantime */
......@@ -1237,9 +1329,6 @@ HWND WINAPI CreateWindowExA( DWORD exStyle, LPCSTR className,
CREATESTRUCTA cs;
char buffer[256];
if(exStyle & WS_EX_MDICHILD)
return CreateMDIWindowA(className, windowName, style, x, y, width, height, parent, instance, (LPARAM)data);
/* Find the class atom */
if (HIWORD(className))
......@@ -1293,9 +1382,6 @@ HWND WINAPI CreateWindowExW( DWORD exStyle, LPCWSTR className,
CREATESTRUCTW cs;
WCHAR buffer[256];
if(exStyle & WS_EX_MDICHILD)
return CreateMDIWindowW(className, windowName, style, x, y, width, height, parent, instance, (LPARAM)data);
/* Find the class atom */
if (HIWORD(className))
......@@ -1409,6 +1495,9 @@ BOOL WINAPI DestroyWindow( HWND hwnd )
SetFocus( parent );
}
if (GetWindowLongW(hwnd, GWL_EXSTYLE) & WS_EX_MDICHILD)
SendMessageW(GetAncestor(hwnd, GA_PARENT), WM_MDIREFRESHMENU, 0, 0);
/* Call hooks */
if (HOOK_CallHooks( WH_CBT, HCBT_DESTROYWND, (WPARAM)hwnd, 0, TRUE )) return FALSE;
......
......@@ -671,6 +671,25 @@ INT WINPROC_MapMsg32ATo32W( HWND hwnd, UINT msg, WPARAM *pwparam, LPARAM *plpara
RtlCreateUnicodeStringFromAsciiz(&usBuffer,(LPCSTR)xs->cs.lpszClass);
xs->lpszClass = xs->cs.lpszClass = usBuffer.Buffer;
}
if (GetWindowLongA(hwnd, GWL_EXSTYLE) & WS_EX_MDICHILD)
{
MDICREATESTRUCTW *mdi_cs = (MDICREATESTRUCTW *)HeapAlloc(GetProcessHeap(), 0,
sizeof(*mdi_cs));
*mdi_cs = *(MDICREATESTRUCTW *)xs->cs.lpCreateParams;
if (HIWORD(mdi_cs->szTitle))
{
RtlCreateUnicodeStringFromAsciiz(&usBuffer, (LPCSTR)mdi_cs->szTitle);
mdi_cs->szTitle = usBuffer.Buffer;
}
if (HIWORD(mdi_cs->szClass))
{
RtlCreateUnicodeStringFromAsciiz(&usBuffer, (LPCSTR)mdi_cs->szClass);
mdi_cs->szClass = usBuffer.Buffer;
}
xs->cs.lpCreateParams = mdi_cs;
}
*plparam = (LPARAM)xs;
}
return 1;
......@@ -829,6 +848,16 @@ LRESULT WINPROC_UnmapMsg32ATo32W( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa
struct s *xs = (struct s *)lParam;
if (xs->lpszName) HeapFree( GetProcessHeap(), 0, xs->lpszName );
if (xs->lpszClass) HeapFree( GetProcessHeap(), 0, xs->lpszClass );
if (GetWindowLongA(hwnd, GWL_EXSTYLE) & WS_EX_MDICHILD)
{
MDICREATESTRUCTW *mdi_cs = (MDICREATESTRUCTW *)xs->cs.lpCreateParams;
if (HIWORD(mdi_cs->szTitle))
HeapFree(GetProcessHeap(), 0, (LPVOID)mdi_cs->szTitle);
if (HIWORD(mdi_cs->szClass))
HeapFree(GetProcessHeap(), 0, (LPVOID)mdi_cs->szClass);
HeapFree(GetProcessHeap(), 0, mdi_cs);
}
HeapFree( GetProcessHeap(), 0, xs );
}
break;
......@@ -952,6 +981,25 @@ INT WINPROC_MapMsg32WTo32A( HWND hwnd, UINT msg, WPARAM *pwparam, LPARAM *plpara
if (HIWORD(cs->lpszClass))
cs->lpszClass = HEAP_strdupWtoA( GetProcessHeap(), 0,
(LPCWSTR)cs->lpszClass);
if (GetWindowLongA(hwnd, GWL_EXSTYLE) & WS_EX_MDICHILD)
{
MDICREATESTRUCTA *mdi_cs = (MDICREATESTRUCTA *)HeapAlloc(GetProcessHeap(), 0,
sizeof(*mdi_cs));
if (!mdi_cs)
{
HeapFree(GetProcessHeap(), 0, cs);
return -1;
}
*mdi_cs = *(MDICREATESTRUCTA *)cs->lpCreateParams;
if (HIWORD(mdi_cs->szTitle))
mdi_cs->szTitle = HEAP_strdupWtoA(GetProcessHeap(), 0,
(LPCWSTR)mdi_cs->szTitle);
if (HIWORD(mdi_cs->szClass))
mdi_cs->szClass = HEAP_strdupWtoA(GetProcessHeap(), 0,
(LPCWSTR)mdi_cs->szClass);
cs->lpCreateParams = (LPVOID)mdi_cs;
}
*plparam = (LPARAM)cs;
}
return 1;
......@@ -1100,6 +1148,15 @@ void WINPROC_UnmapMsg32WTo32A( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam
HeapFree( GetProcessHeap(), 0, (LPVOID)cs->lpszName );
if (HIWORD(cs->lpszClass))
HeapFree( GetProcessHeap(), 0, (LPVOID)cs->lpszClass );
if (GetWindowLongA(hwnd, GWL_EXSTYLE) & WS_EX_MDICHILD)
{
MDICREATESTRUCTA *mdi_cs = (MDICREATESTRUCTA *)cs->lpCreateParams;
if (HIWORD(mdi_cs->szTitle))
HeapFree(GetProcessHeap(), 0, (LPVOID)mdi_cs->szTitle);
if (HIWORD(mdi_cs->szClass))
HeapFree(GetProcessHeap(), 0, (LPVOID)mdi_cs->szClass);
HeapFree(GetProcessHeap(), 0, mdi_cs);
}
HeapFree( GetProcessHeap(), 0, cs );
}
break;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment