reorganize CreateWindowEx

This commit is contained in:
Christian Semmler 2023-06-22 19:28:37 +02:00
parent 25076251f4
commit 87b3c7437e
No known key found for this signature in database
GPG Key ID: 086DAA1360BEEE5C

View File

@ -487,12 +487,12 @@ MxResult Isle::SetupWindow(HINSTANCE hInstance, LPSTR lpCmdLine)
wndclass.style = CS_HREDRAW | CS_VREDRAW; wndclass.style = CS_HREDRAW | CS_VREDRAW;
wndclass.lpfnWndProc = WndProc; wndclass.lpfnWndProc = WndProc;
wndclass.cbWndExtra = 0; wndclass.cbWndExtra = 0;
wndclass.hIcon = LoadIconA(hInstance, MAKEINTRESOURCE(APP_ICON)); wndclass.hIcon = LoadIconA(hInstance, MAKEINTRESOURCEA(APP_ICON));
wndclass.hCursor = LoadCursorA(hInstance, MAKEINTRESOURCE(ISLE_ARROW)); wndclass.hCursor = LoadCursorA(hInstance, MAKEINTRESOURCEA(ISLE_ARROW));
m_cursorCurrent = wndclass.hCursor; m_cursorCurrent = wndclass.hCursor;
m_cursorArrow = wndclass.hCursor; m_cursorArrow = wndclass.hCursor;
m_cursorBusy = LoadCursorA(hInstance, MAKEINTRESOURCE(ISLE_BUSY)); m_cursorBusy = LoadCursorA(hInstance, MAKEINTRESOURCEA(ISLE_BUSY));
m_cursorNo = LoadCursorA(hInstance, MAKEINTRESOURCE(ISLE_NO)); m_cursorNo = LoadCursorA(hInstance, MAKEINTRESOURCEA(ISLE_NO));
wndclass.hInstance = hInstance; wndclass.hInstance = hInstance;
wndclass.hbrBackground = (HBRUSH) GetStockObject(BLACK_BRUSH); wndclass.hbrBackground = (HBRUSH) GetStockObject(BLACK_BRUSH);
wndclass.lpszClassName = WNDCLASS_NAME; wndclass.lpszClassName = WNDCLASS_NAME;
@ -501,31 +501,36 @@ MxResult Isle::SetupWindow(HINSTANCE hInstance, LPSTR lpCmdLine)
return FAILURE; return FAILURE;
} }
DWORD dwStyle; if (m_fullScreen) {
int width, height, x, y;
if (!m_fullScreen) {
AdjustWindowRectEx(&g_windowRect, WS_CAPTION | WS_SYSMENU, 0, WS_EX_APPWINDOW); AdjustWindowRectEx(&g_windowRect, WS_CAPTION | WS_SYSMENU, 0, WS_EX_APPWINDOW);
height = g_windowRect.bottom - g_windowRect.top; m_windowHandle = CreateWindowExA(
width = g_windowRect.right - g_windowRect.left; WS_EX_APPWINDOW,
WNDCLASS_NAME,
y = CW_USEDEFAULT; WINDOW_TITLE,
x = CW_USEDEFAULT; WS_CAPTION | WS_SYSMENU,
dwStyle = WS_CAPTION | WS_SYSMENU | WS_MAXIMIZEBOX | WS_MINIMIZEBOX; g_windowRect.left,
g_windowRect.top,
g_windowRect.right - g_windowRect.left + 1,
g_windowRect.bottom - g_windowRect.top + 1,
NULL, NULL, hInstance, NULL
);
} else { } else {
AdjustWindowRectEx(&g_windowRect, WS_CAPTION | WS_SYSMENU, 0, WS_EX_APPWINDOW); AdjustWindowRectEx(&g_windowRect, WS_CAPTION | WS_SYSMENU, 0, WS_EX_APPWINDOW);
height = g_windowRect.bottom - g_windowRect.top; m_windowHandle = CreateWindowExA(
width = g_windowRect.right - g_windowRect.left; WS_EX_APPWINDOW,
WNDCLASS_NAME,
dwStyle = WS_CAPTION | WS_SYSMENU; WINDOW_TITLE,
x = g_windowRect.left; WS_CAPTION | WS_SYSMENU | WS_MAXIMIZEBOX | WS_MINIMIZEBOX,
y = g_windowRect.top; CW_USEDEFAULT,
CW_USEDEFAULT,
g_windowRect.right - g_windowRect.left + 1,
g_windowRect.bottom - g_windowRect.top + 1,
NULL, NULL, hInstance, NULL
);
} }
m_windowHandle = CreateWindowExA(WS_EX_APPWINDOW, WNDCLASS_NAME, WINDOW_TITLE, dwStyle,
x, y, width + 1, height + 1, NULL, NULL, hInstance, NULL);
if (!m_windowHandle) { if (!m_windowHandle) {
return FAILURE; return FAILURE;
} }