+#if defined(__PALMOS__)
+# ifndef __WXPALMOS__
+# define __WXPALMOS__
+# endif
+# ifdef __WXMSW__
+# undef __WXMSW__
+# endif
+# ifdef __WINDOWS__
+# undef __WINDOWS__
+# endif
+# ifdef __WIN32__
+# undef __WIN32__
+# endif
+# ifdef WIN32
+# undef WIN32
+# endif
+# ifdef _WIN32
+# undef _WIN32
+# endif
+#endif
+
+#if defined(_WIN64)
+# ifndef _WIN32
+ /*
+ a lot of code (mistakenly) uses #ifdef _WIN32 to either test for
+ Windows or to test for !__WIN16__, so we must define _WIN32 for
+ Win64 as well to ensure that the existing code continues to work.
+ */
+# define _WIN32
+# endif /* !_WIN32 */
+
+# ifndef __WIN64__
+# define __WIN64__
+# endif /* !__WIN64__ */
+#endif /* _WIN64 */
+
+#if (defined(_WIN32) || defined(WIN32) || defined(__NT__) || defined(__WXWINCE__)) \
+ && !defined(__WXMOTIF__) && !defined(__WXGTK__) && !defined(__WXX11__)
+# ifndef __WXMSW__
+# define __WXMSW__
+# endif
+
+# ifndef __WIN32__
+# define __WIN32__
+# endif
+
+ /*
+ The library user may override the default setting of WINVER by defining
+ it in his own makefile or project file -- if it is defined, we don't
+ touch it at all.
+
+ It makes sense to define WINVER as:
+ - either some lowish value (e.g. 0x0302) to not even compile in the
+ features not available in Windows version lower than some given
+ one
+ - or to a higher value than the one used by default for the given
+ compiler if you updated its headers to newer version of Platform
+ SDK, e.g. VC6 ships with 0x0400 headers by default but may also
+ work with 0x0500 headers and beyond
+ */
+# ifndef WINVER
+# if defined(_MSC_VER) && _MSC_VER < 1300
+ /*
+ VC6 defines some stuff in its default headers which is normally
+ only present if WINVER >= 0x0500 (FLASHW_XXX constants) which
+ means that our usual tests not involving WINVER sometimes fail
+ with it, hence explicitly define a lower WINVER value for it.
+ */
+# define WINVER 0x0400
+# elif defined(__DMC__)
+ /*
+ Digital Mars is distributed with a little outdated headers.
+ */
+# define WINVER 0x0400
+# else /* !VC++ 6 */
+ /*
+ see MSDN for the description of possible WINVER values, this one
+ is the highest one defined right now (Windows Server 2003) and
+ we use it unless it was explicitly overridden by the user to
+ disable recent features support as we check for all of the
+ features we use which could be not available on earlier Windows
+ systems during run-time anyhow, so there is almost no
+ disadvantage in using it.
+ */
+# define WINVER 0x0502
+# endif /* VC++ 6/!VC++6 */
+# endif