+// ----------------------------------------------------------------------------
+// windows.h #defines the following identifiers which are also used in wxWin so
+// we replace these symbols with the corresponding inline functions and
+// undefine the macro.
+//
+// This looks quite ugly here but allows us to write clear (and correct!) code
+// elsewhere because the functions, unlike the macros, respect the scope.
+// ----------------------------------------------------------------------------
+
+// CreateDialog
+
+#if defined(CreateDialog)
+ #undef CreateDialog
+
+ inline HWND CreateDialog(HINSTANCE hInstance,
+ LPCTSTR pTemplate,
+ HWND hwndParent,
+ DLGPROC pDlgProc)
+ {
+ #ifdef _UNICODE
+ return CreateDialogW(hInstance, pTemplate, hwndParent, pDlgProc);
+ #else
+ return CreateDialogA(hInstance, pTemplate, hwndParent, pDlgProc);
+ #endif
+ }
+#endif
+
+// CreateFont
+
+#ifdef CreateFont
+ #undef CreateFont
+
+ inline HFONT CreateFont(int height,
+ int width,
+ int escapement,
+ int orientation,
+ int weight,
+ DWORD italic,
+ DWORD underline,
+ DWORD strikeout,
+ DWORD charset,
+ DWORD outprecision,
+ DWORD clipprecision,
+ DWORD quality,
+ DWORD family,
+ LPCTSTR facename)
+ {
+ #ifdef _UNICODE
+ return CreateFontW(height, width, escapement, orientation,
+ weight, italic, underline, strikeout, charset,
+ outprecision, clipprecision, quality,
+ family, facename);
+ #else
+ return CreateFontA(height, width, escapement, orientation,
+ weight, italic, underline, strikeout, charset,
+ outprecision, clipprecision, quality,
+ family, facename);
+ #endif
+ }
+#endif // CreateFont
+
+// CreateWindow
+
+#if defined(CreateWindow)
+ #undef CreateWindow
+
+ inline HWND CreateWindow(LPCTSTR lpClassName,
+ LPCTSTR lpWndClass,
+ DWORD dwStyle,
+ int x, int y, int w, int h,
+ HWND hWndParent,
+ HMENU hMenu,
+ HINSTANCE hInstance,
+ LPVOID lpParam)
+ {
+ #ifdef _UNICODE
+ return CreateWindowW(lpClassName, lpWndClass, dwStyle, x, y, w, h,
+ hWndParent, hMenu, hInstance, lpParam);
+ #else
+ return CreateWindowA(lpClassName, lpWndClass, dwStyle, x, y, w, h,
+ hWndParent, hMenu, hInstance, lpParam);
+ #endif
+ }
+#endif
+
+// LoadMenu
+
+#ifdef LoadMenu
+ #undef LoadMenu
+
+ inline HMENU LoadMenu(HINSTANCE instance, LPCTSTR name)
+ {
+ #ifdef _UNICODE
+ return LoadMenuW(instance, name);
+ #else
+ return LoadMenuA(instance, name);
+ #endif
+ }
+#endif
+
+// FindText
+
+#ifdef FindText
+ #undef FindText
+
+ inline HWND APIENTRY FindText(LPFINDREPLACE lpfindreplace)
+ {
+ #ifdef _UNICODE
+ return FindTextW(lpfindreplace);
+ #else
+ return FindTextA(lpfindreplace);
+ #endif
+ }
+#endif