user32: Don't fail on windows without menu bar in DrawMenuBar.
This commit is contained in:
parent
b045851648
commit
55ff066103
|
@ -4360,17 +4360,18 @@ HMENU WINAPI GetSubMenu( HMENU hMenu, INT nPos )
|
|||
BOOL WINAPI DrawMenuBar( HWND hWnd )
|
||||
{
|
||||
LPPOPUPMENU lppop;
|
||||
HMENU hMenu = GetMenu(hWnd);
|
||||
HMENU hMenu;
|
||||
|
||||
if (!WIN_ALLOWED_MENU(GetWindowLongW( hWnd, GWL_STYLE )))
|
||||
if (!IsWindow( hWnd ))
|
||||
return FALSE;
|
||||
if (!hMenu || !(lppop = MENU_GetMenu( hMenu ))) return FALSE;
|
||||
|
||||
lppop->Height = 0; /* Make sure we call MENU_MenuBarCalcSize */
|
||||
lppop->hwndOwner = hWnd;
|
||||
SetWindowPos( hWnd, 0, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE |
|
||||
SWP_NOACTIVATE | SWP_NOZORDER | SWP_FRAMECHANGED );
|
||||
return TRUE;
|
||||
if ((hMenu = GetMenu( hWnd )) && (lppop = MENU_GetMenu( hMenu ))) {
|
||||
lppop->Height = 0; /* Make sure we call MENU_MenuBarCalcSize */
|
||||
lppop->hwndOwner = hWnd;
|
||||
}
|
||||
|
||||
return SetWindowPos( hWnd, 0, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE |
|
||||
SWP_NOACTIVATE | SWP_NOZORDER | SWP_FRAMECHANGED );
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
|
|
|
@ -425,9 +425,7 @@ static void test_menu_locked_by_window(void)
|
|||
ok(ret, "DestroyMenu failed with error %d\n", GetLastError());
|
||||
|
||||
ret = DrawMenuBar(hwnd);
|
||||
todo_wine {
|
||||
ok(ret, "DrawMenuBar failed with error %d\n", GetLastError());
|
||||
}
|
||||
ret = IsMenu(GetMenu(hwnd));
|
||||
ok(!ret || broken(ret) /* nt4 */, "Menu handle should have been destroyed\n");
|
||||
|
||||
|
|
|
@ -4819,13 +4819,19 @@ static void test_messages(void)
|
|||
after_end_dialog = FALSE;
|
||||
test_def_id = FALSE;
|
||||
|
||||
hwnd = CreateWindowExA(0, "TestDialogClass", NULL, WS_POPUP,
|
||||
hwnd = CreateWindowExA(0, "TestDialogClass", NULL, WS_POPUP|WS_CHILD,
|
||||
0, 0, 100, 100, 0, 0, GetModuleHandleA(0), NULL);
|
||||
ok(hwnd != 0, "Failed to create custom dialog window\n");
|
||||
flush_sequence();
|
||||
trace("call ShowWindow(%p, SW_SHOW)\n", hwnd);
|
||||
ShowWindow(hwnd, SW_SHOW);
|
||||
ok_sequence(WmShowCustomDialogSeq, "ShowCustomDialog", TRUE);
|
||||
|
||||
flush_events();
|
||||
flush_sequence();
|
||||
ok(DrawMenuBar(hwnd), "DrawMenuBar failed: %d\n", GetLastError());
|
||||
flush_events();
|
||||
ok_sequence(WmDrawMenuBarSeq, "DrawMenuBar", FALSE);
|
||||
DestroyWindow(hwnd);
|
||||
|
||||
flush_sequence();
|
||||
|
@ -4836,7 +4842,8 @@ static void test_messages(void)
|
|||
flush_sequence();
|
||||
|
||||
/* Message sequence for SetMenu */
|
||||
ok(!DrawMenuBar(hwnd), "DrawMenuBar should return FALSE for a window without a menu\n");
|
||||
ok(!DrawMenuBar(hwnd), "DrawMenuBar should return FALSE for a destroyed window\n");
|
||||
ok(GetLastError() == ERROR_INVALID_WINDOW_HANDLE, "last error is %d\n", GetLastError());
|
||||
ok_sequence(WmEmptySeq, "DrawMenuBar for a window without a menu", FALSE);
|
||||
|
||||
hmenu = CreateMenu();
|
||||
|
|
Loading…
Reference in New Issue