From 1d72f6af7e9c20fefdde3b04b4af060236986e42 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 5 Jan 2019 00:01:09 +0100 Subject: [PATCH] Fix wxMSW build in non-Unicode mode Convert WCHAR to TCHAR explicitly in this case. Closes #18320. --- src/msw/artmsw.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/msw/artmsw.cpp b/src/msw/artmsw.cpp index 1d836fd56e..93171b3b0c 100644 --- a/src/msw/artmsw.cpp +++ b/src/msw/artmsw.cpp @@ -137,6 +137,21 @@ MSWGetBitmapFromIconLocation(const TCHAR* path, int index, const wxSize& size) return wxBitmap(icon); } +#if !wxUSE_UNICODE + +// SHSTOCKICONINFO always uses WCHAR, even in ANSI build, so we need to convert +// it to TCHAR, which is just CHAR in this case, used by the other functions. +// Provide an overload doing it as this keeps the code in the main function +// clean and this entire block (inside !wxUSE_UNICODE check) can be just +// removed when support for ANSI build is finally dropped. +wxBitmap +MSWGetBitmapFromIconLocation(const WCHAR* path, int index, const wxSize& size) +{ + return MSWGetBitmapFromIconLocation(wxString(path).mb_str(), index, size); +} + +#endif // !wxUSE_UNICODE + wxBitmap MSWGetBitmapForPath(const wxString& path, const wxSize& size, DWORD uFlags = 0) {