Commit 01a88ff0 authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

If there no MDI child to activate set hwndActiveChild to 0 in

WM_MDIDESTROY hander, add a test case.
parent f2dca03d
......@@ -1522,6 +1522,7 @@ static BOOL mdi_RegisterWindowClasses(void)
static void test_mdi_messages(void)
{
MDICREATESTRUCTA mdi_cs;
CLIENTCREATESTRUCT client_cs;
HWND mdi_frame, mdi_child, mdi_child2, active_child;
BOOL zoomed;
......@@ -1807,6 +1808,29 @@ static void test_mdi_messages(void)
flush_sequence();
/* end of test for maximized MDI children */
mdi_cs.szClass = "MDI_child_Class";
mdi_cs.szTitle = "MDI child";
mdi_cs.hOwner = GetModuleHandleA(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_CHILD | WS_VISIBLE | WS_MAXIMIZEBOX;
mdi_cs.lParam = 0;
mdi_child = (HWND)SendMessageA(mdi_client, WM_MDICREATE, 0, (LPARAM)&mdi_cs);
ok(mdi_child != 0, "MDI child creation failed\n");
active_child = (HWND)SendMessageA(mdi_client, WM_MDIGETACTIVE, 0, (LPARAM)&zoomed);
ok(active_child == mdi_child, "wrong active MDI child %p\n", active_child);
SendMessageA(mdi_client, WM_MDIDESTROY, (WPARAM)mdi_child, 0);
ok(!IsWindow(mdi_child), "MDI child should be destroyed\n");
active_child = (HWND)SendMessageA(mdi_client, WM_MDIGETACTIVE, 0, (LPARAM)&zoomed);
ok(!active_child, "wrong active MDI child %p\n", active_child);
SetFocus(0);
flush_sequence();
DestroyWindow(mdi_client);
ok_sequence(WmDestroyMDIclientSeq, "Destroy MDI client window", FALSE);
......
......@@ -525,7 +525,10 @@ static LRESULT MDIDestroyChild( HWND parent, MDICLIENTINFO *ci,
if( child == ci->hwndActiveChild )
{
HWND next = MDI_GetWindow(ci, child, TRUE, 0);
MDI_SwitchActiveChild(ci, next);
if (next)
MDI_SwitchActiveChild(ci, next);
else
ci->hwndActiveChild = 0; /* nothing to activate */
}
for (i = 0; i < ci->nActiveChildren; i++)
......
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