summaryrefslogtreecommitdiff
path: root/src/drivers/WinAPI
diff options
context:
space:
mode:
authorAlbrecht Schlosser <albrechts.fltk@online.de>2023-04-24 14:26:56 +0200
committerAlbrecht Schlosser <albrechts.fltk@online.de>2023-04-24 14:26:56 +0200
commit6f77f40aadaaec8ab0e29d3ae5c9f6e5792c4a41 (patch)
tree22872fb5efdc3c8caa4817b88fc6a04f3ae39dd4 /src/drivers/WinAPI
parent4bf9172a8e4f76842a2e011671cf5c057e8fe1d1 (diff)
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.
Diffstat (limited to 'src/drivers/WinAPI')
-rw-r--r--src/drivers/WinAPI/Fl_WinAPI_System_Driver.cxx9
1 files changed, 9 insertions, 0 deletions
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 <direct.h>
#include <io.h>
#include <fcntl.h>
+
+// 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 <shlobj.h>
// function pointer for the UuidCreate Function