From ccc4fb3a9d936d703ccfa9861e28f256850c98f4 Mon Sep 17 00:00:00 2001 From: Margen67 Date: Mon, 16 Dec 2024 21:52:43 -0800 Subject: [PATCH] Update WndMain.cpp --- src/gui/WndMain.cpp | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/gui/WndMain.cpp b/src/gui/WndMain.cpp index f558cb88ec..2503bd9921 100644 --- a/src/gui/WndMain.cpp +++ b/src/gui/WndMain.cpp @@ -259,16 +259,19 @@ LRESULT CALLBACK WndMain::WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lP { case WM_CREATE: { - // Remove rounded corners from the render window on Windows 11 - const DWM_WINDOW_CORNER_PREFERENCE corner_preference = DWMWCP_DONOTROUND; - DwmSetWindowAttribute(hwnd, DWMWA_WINDOW_CORNER_PREFERENCE, &corner_preference, - sizeof(corner_preference)); - // initialize menu - { - HMENU hMenu = LoadMenu(m_hInstance, MAKEINTRESOURCE(IDR_MAINMENU)); + if (hwnd) + { + // Remove rounded corners from the render window on Windows 11 + const DWM_WINDOW_CORNER_PREFERENCE corner_preference = DWMWCP_DONOTROUND; + DwmSetWindowAttribute(hwnd, DWMWA_WINDOW_CORNER_PREFERENCE, &corner_preference, + sizeof(corner_preference)); + // initialize menu + { + HMENU hMenu = LoadMenu(m_hInstance, MAKEINTRESOURCE(IDR_MAINMENU)); - SetMenu(hwnd, hMenu); - } + SetMenu(hwnd, hMenu); + } + } // Set window size to GUI dimensions ResizeWindow(hwnd, /*bForGUI=*/true);