fix Windows XP Compatibility #315

Use the IsWindowsVistaOrGreater() function from VersionHelpers.h, which
fortunately is part of mingw, to check for the availability of the
comctl32 LoadIconWithScaleDown API, which we use to fix issues with the
app icon, like the icon being too big in the volume mixer.
This commit is contained in:
Rafael Kitover 2018-10-23 06:19:34 -07:00
parent 1bf51ec1fa
commit 9cb9ce86bd
1 changed files with 17 additions and 14 deletions

View File

@ -2537,6 +2537,7 @@ void MainFrame::MenuOptionIntRadioValue(const char* menuName, int& field, int va
#ifdef __WXMSW__ #ifdef __WXMSW__
#include <windows.h> #include <windows.h>
#include <VersionHelpers.h>
#include <commctrl.h> #include <commctrl.h>
#include <wx/msw/private.h> #include <wx/msw/private.h>
typedef int (WINAPI *func_LoadIconWithScaleDown)(HINSTANCE, LPCWSTR, int, int, HICON*); typedef int (WINAPI *func_LoadIconWithScaleDown)(HINSTANCE, LPCWSTR, int, int, HICON*);
@ -2544,6 +2545,7 @@ void MainFrame::MenuOptionIntRadioValue(const char* menuName, int& field, int va
void MainFrame::BindAppIcon() { void MainFrame::BindAppIcon() {
#ifdef __WXMSW__ #ifdef __WXMSW__
if (IsWindowsVistaOrGreater()) {
wxDynamicLibrary comctl32("comctl32", wxDL_DEFAULT | wxDL_QUIET); wxDynamicLibrary comctl32("comctl32", wxDL_DEFAULT | wxDL_QUIET);
func_LoadIconWithScaleDown load_icon_scaled = reinterpret_cast<func_LoadIconWithScaleDown>(comctl32.GetSymbol("LoadIconWithScaleDown")); func_LoadIconWithScaleDown load_icon_scaled = reinterpret_cast<func_LoadIconWithScaleDown>(comctl32.GetSymbol("LoadIconWithScaleDown"));
int icon_set_count = 0; int icon_set_count = 0;
@ -2560,6 +2562,7 @@ void MainFrame::BindAppIcon() {
} }
if (icon_set_count == 2) return; if (icon_set_count == 2) return;
}
// otherwise fall back to Wx method of setting icon // otherwise fall back to Wx method of setting icon
#endif #endif
wxIcon icon = wxXmlResource::Get()->LoadIcon(wxT("MainIcon")); wxIcon icon = wxXmlResource::Get()->LoadIcon(wxT("MainIcon"));