From 67d573cd41fdc4c78e5c38b1448da4b2b21179c4 Mon Sep 17 00:00:00 2001 From: Ritchie Swann Date: Sun, 11 Aug 2024 09:30:20 +0100 Subject: [PATCH] Use TCHAR for Windows --- libraries/ZWidget/src/window/win32/win32window.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/libraries/ZWidget/src/window/win32/win32window.cpp b/libraries/ZWidget/src/window/win32/win32window.cpp index 3ba21698ab..54350513d6 100644 --- a/libraries/ZWidget/src/window/win32/win32window.cpp +++ b/libraries/ZWidget/src/window/win32/win32window.cpp @@ -1,6 +1,7 @@ #include "win32window.h" #include +#include #include #include #include @@ -65,7 +66,7 @@ Win32Window::Win32Window(DisplayWindowHost* windowHost) : WindowHost(windowHost) classdesc.cbSize = sizeof(WNDCLASSEX); classdesc.hInstance = GetModuleHandle(0); classdesc.style = CS_VREDRAW | CS_HREDRAW | CS_DBLCLKS; - classdesc.lpszClassName = L"ZWidgetWindow"; + classdesc.lpszClassName = _T( "ZWidgetWindow" ); classdesc.lpfnWndProc = &Win32Window::WndProc; RegisterClassEx(&classdesc); @@ -74,7 +75,7 @@ Win32Window::Win32Window(DisplayWindowHost* windowHost) : WindowHost(windowHost) // WS_CAPTION shows the caption (yay! actually a flag that does what it says it does!) // WS_SYSMENU shows the min/max/close buttons // WS_THICKFRAME makes the window resizable - CreateWindowEx(WS_EX_APPWINDOW | WS_EX_DLGMODALFRAME, L"ZWidgetWindow", L"", WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX, 0, 0, 100, 100, 0, 0, GetModuleHandle(0), this); + CreateWindowEx(WS_EX_APPWINDOW | WS_EX_DLGMODALFRAME, _T( "ZWidgetWindow" ), _T( "" ), WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX, 0, 0, 100, 100, 0, 0, GetModuleHandle(0), this); /* RAWINPUTDEVICE rid; @@ -278,7 +279,7 @@ double Win32Window::GetDpiScale() const static bool done = false; if (!done) { - HMODULE hMod = GetModuleHandleA("User32.dll"); + HMODULE hMod = GetModuleHandle( _T( "User32.dll" )); if (hMod != nullptr) pGetDpiForWindow = reinterpret_cast(GetProcAddress(hMod, "GetDpiForWindow")); done = true; } @@ -387,8 +388,10 @@ void Win32Window::PresentBitmap(int width, int height, const uint32_t* pixels) LRESULT Win32Window::OnWindowMessage(UINT msg, WPARAM wparam, LPARAM lparam) { LPARAM result = 0; - if (DwmDefWindowProc(WindowHandle, msg, wparam, lparam, &result)) - return result; + + // DwmDefWindowProc is not a publicly defined symbol on Windows 11 + /*if (DwmDefWindowProc(WindowHandle, msg, wparam, lparam, &result)) + return result;*/ if (msg == WM_INPUT) {