From dcdf4dbf151606416abfe54b4436096cae433ecb Mon Sep 17 00:00:00 2001 From: Piotr Caban Date: Tue, 23 Sep 2014 16:51:53 +0200 Subject: [PATCH] user32: Return early on child windows in DrawMenuBar. --- dlls/user32/menu.c | 2 ++ dlls/user32/tests/msg.c | 12 ++++++++++++ 2 files changed, 14 insertions(+) diff --git a/dlls/user32/menu.c b/dlls/user32/menu.c index 9e05dd4eb15..f0eb66bda79 100644 --- a/dlls/user32/menu.c +++ b/dlls/user32/menu.c @@ -4360,6 +4360,8 @@ BOOL WINAPI DrawMenuBar( HWND hWnd ) if (!IsWindow( hWnd )) return FALSE; + if (!WIN_ALLOWED_MENU(GetWindowLongW( hWnd, GWL_STYLE ))) + return TRUE; if ((hMenu = GetMenu( hWnd )) && (lppop = MENU_GetMenu( hMenu ))) { lppop->Height = 0; /* Make sure we call MENU_MenuBarCalcSize */ diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c index 6badca106b7..90b87cb9055 100644 --- a/dlls/user32/tests/msg.c +++ b/dlls/user32/tests/msg.c @@ -4871,6 +4871,18 @@ static void test_messages(void) flush_events(); ok_sequence(WmDrawMenuBarSeq, "DrawMenuBar", FALSE); ok(SetCursorPos(pos.x, pos.y), "SetCursorPos failed\n"); + + DestroyWindow(hwnd); + + hwnd = CreateWindowExA(0, "TestDialogClass", NULL, WS_CHILD|WS_VISIBLE, + 0, 0, 100, 100, hparent, 0, GetModuleHandleA(0), NULL); + ok(hwnd != 0, "Failed to create custom dialog window\n"); + flush_events(); + flush_sequence(); + ok(DrawMenuBar(hwnd), "DrawMenuBar failed: %d\n", GetLastError()); + flush_events(); + ok_sequence(WmEmptySeq, "DrawMenuBar for a child window", FALSE); + DestroyWindow(hwnd); flush_sequence();