From 6f77f40aadaaec8ab0e29d3ae5c9f6e5792c4a41 Mon Sep 17 00:00:00 2001 From: Albrecht Schlosser Date: Mon, 24 Apr 2023 14:26:56 +0200 Subject: Windows: define _WIN32_IE for older MinGW versions (#710) ... if _WIN32_IE is not defined. Older MinGW versions would otherwise not define SHGFP_TYPE_CURRENT which is needed since commit 5a4e7caa54bab9da2061b0003bb546aa0da6ea1b that fixes GitHub issue #710: "Fl_Preferences not stored on Windows 10". This commit is based on Ian's work as discussed in fltk.coredev, thread "fltk-1.4 build error in Fl_WinAPI_System_Driver.cxx with 32-bit mingw" on Apr 20, 2023. --- src/drivers/WinAPI/Fl_WinAPI_System_Driver.cxx | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/drivers/WinAPI') diff --git a/src/drivers/WinAPI/Fl_WinAPI_System_Driver.cxx b/src/drivers/WinAPI/Fl_WinAPI_System_Driver.cxx index 681e519bf..cda8c1b36 100644 --- a/src/drivers/WinAPI/Fl_WinAPI_System_Driver.cxx +++ b/src/drivers/WinAPI/Fl_WinAPI_System_Driver.cxx @@ -39,6 +39,15 @@ #include #include #include + +// We must define _WIN32_IE at least to 0x0500 before inclusion of 'shlobj.h' to enable +// the declaration of SHGFP_TYPE_CURRENT for some older versions of MinGW, notably +// header versions 5.3.0 and earlier, whereas 5.4.2 seems to define _WIN32_IE as needed. +#if !(defined _WIN32_IE) || (_WIN32_IE < 0x0500) +# undef _WIN32_IE +# define _WIN32_IE 0x0500 +#endif /* _WIN32_WINNT checks */ + #include // function pointer for the UuidCreate Function -- cgit v1.2.3