diff --git a/cmake/wrap_standalone.cmake b/cmake/wrap_standalone.cmake index 0dab3b34..60d5547b 100644 --- a/cmake/wrap_standalone.cmake +++ b/cmake/wrap_standalone.cmake @@ -122,7 +122,8 @@ function(target_add_standalone_wrapper) CLAP_WRAPPER_HAS_WIN32 ) - target_compile_definitions(${salib} PUBLIC + target_compile_definitions(${SA_TARGET} PRIVATE + UNICODE NOMINMAX ) diff --git a/src/detail/standalone/windows/windows_standalone.cpp b/src/detail/standalone/windows/windows_standalone.cpp index 6acfd415..db74faee 100644 --- a/src/detail/standalone/windows/windows_standalone.cpp +++ b/src/detail/standalone/windows/windows_standalone.cpp @@ -31,15 +31,15 @@ ::HBRUSH getBrushFromSystem(int name) return static_cast<::HBRUSH>(::GetStockObject(name)); } -::HCURSOR getCursorFromSystem(::LPCSTR name) +::HCURSOR getCursorFromSystem(::LPCWSTR name) { return static_cast<::HCURSOR>( - ::LoadImageA(nullptr, name, IMAGE_CURSOR, 0, 0, LR_SHARED | LR_DEFAULTSIZE)); + ::LoadImageW(nullptr, name, IMAGE_CURSOR, 0, 0, LR_SHARED | LR_DEFAULTSIZE)); } -::HICON getIconFromSystem(::LPCSTR name) +::HICON getIconFromSystem(::LPCWSTR name) { - return static_cast<::HICON>(::LoadImageA(nullptr, name, IMAGE_ICON, 0, 0, LR_SHARED | LR_DEFAULTSIZE)); + return static_cast<::HICON>(::LoadImageW(nullptr, name, IMAGE_ICON, 0, 0, LR_SHARED | LR_DEFAULTSIZE)); } ::HICON getIconFromResource() @@ -433,7 +433,7 @@ void Control::refreshFont(double scale) void ComboBox::create(const std::string& name, uintptr_t id, ::HWND parentHwnd) { - hwnd.reset(::CreateWindowExW(0, toUTF16(WC_COMBOBOX).c_str(), toUTF16(name).c_str(), + hwnd.reset(::CreateWindowExW(0, WC_COMBOBOXW, toUTF16(name).c_str(), WS_CHILD | WS_VISIBLE | CBS_DROPDOWNLIST, 0, 0, 0, 0, parentHwnd, (::HMENU)id, getInstance(), nullptr)); @@ -494,7 +494,7 @@ ::LRESULT CALLBACK ComboBox::procedure(::HWND hwnd, ::UINT msg, ::WPARAM wparam, void ListBox::create(const std::string& name, uintptr_t id, ::HWND parentHwnd) { - hwnd.reset(::CreateWindowExW(0, toUTF16(WC_LISTBOX).c_str(), toUTF16(name).c_str(), + hwnd.reset(::CreateWindowExW(0, WC_LISTBOXW, toUTF16(name).c_str(), WS_CHILD | WS_VISIBLE | LBS_MULTIPLESEL | LBS_NOTIFY, 0, 0, 0, 0, parentHwnd, (::HMENU)id, getInstance(), nullptr)); diff --git a/src/detail/standalone/windows/windows_standalone.h b/src/detail/standalone/windows/windows_standalone.h index c3830366..71e8a240 100644 --- a/src/detail/standalone/windows/windows_standalone.h +++ b/src/detail/standalone/windows/windows_standalone.h @@ -39,8 +39,8 @@ ::HMODULE getInstance(); ::HFONT getFontFromSystem(int name = DEFAULT_GUI_FONT); ::HFONT getScaledFontFromSystem(double scale); ::HBRUSH getBrushFromSystem(int name = BLACK_BRUSH); -::HCURSOR getCursorFromSystem(::LPCSTR name = IDC_ARROW); -::HICON getIconFromSystem(::LPCSTR name = IDI_APPLICATION); +::HCURSOR getCursorFromSystem(::LPCWSTR name = IDC_ARROW); +::HICON getIconFromSystem(::LPCWSTR name = IDI_APPLICATION); ::HICON getIconFromResource(); ::HMENU getSystemMenu(::HWND hwnd);