]> git.saurik.com Git - wxWidgets.git/blobdiff - include/wx/msw/private.h
Add wxABI_VERSION wrappers
[wxWidgets.git] / include / wx / msw / private.h
index f015082b7e37a9bf7605a0a93a3b4ef2da4fb75a..9489b2fd68c776e42eb7008efc14d4f30b721f8b 100644 (file)
@@ -188,11 +188,26 @@ extern LONG APIENTRY _EXPORT
    || defined(__BORLANDC__) \
    || defined(__DMC__) \
    || defined(__WATCOMC__) \
-   || (defined(__GNUWIN32__) || defined(__MINGW32__)) \
+   || defined(__MINGW32__) \
    || (defined(__MWERKS__) && defined(__MSL__))
     #define wxGetOSFHandle(fd) ((HANDLE)_get_osfhandle(fd))
 #endif
 
+// close the handle in the class dtor
+class AutoHANDLE
+{
+public:
+    wxEXPLICIT AutoHANDLE(HANDLE handle) : m_handle(handle) { }
+
+    bool IsOk() const { return m_handle != INVALID_HANDLE_VALUE; }
+    operator HANDLE() const { return m_handle; }
+
+    ~AutoHANDLE() { if ( IsOk() ) ::CloseHandle(m_handle); }
+
+protected:
+    HANDLE m_handle;
+};
+
 #if wxUSE_GUI
 
 #include <wx/gdicmn.h>
@@ -701,6 +716,43 @@ inline wxString wxGetFullModuleName()
     return wxGetFullModuleName((HMODULE)wxGetInstance());
 }
 
+// return the run-time version of the OS in a format similar to
+// WINVER/_WIN32_WINNT compile-time macros:
+//
+//      0x0300      Windows NT 3.51
+//      0x0400      Windows 95, NT4
+//      0x0410      Windows 98
+//      0x0500      Windows ME, 2000
+//      0x0501      Windows XP
+//      0x0502      Windows 2003
+//      0x0600      Longhorn
+//
+// for the other Windows versions 0 is currently returned
+enum wxWinVersion
+{
+    wxWinVersion_Unknown = 0,
+
+    wxWinVersion_3 = 0x0300,
+    wxWinVersion_NT3 = wxWinVersion_3,
+
+    wxWinVersion_4 = 0x0400,
+    wxWinVersion_95 = wxWinVersion_4,
+    wxWinVersion_NT4 = wxWinVersion_4,
+    wxWinVersion_98 = 0x0410,
+
+    wxWinVersion_5 = 0x0500,
+    wxWinVersion_ME = wxWinVersion_5,
+    wxWinVersion_NT5 = wxWinVersion_5,
+    wxWinVersion_2000 = wxWinVersion_5,
+    wxWinVersion_XP = 0x0501,
+    wxWinVersion_2003 = 0x0502,
+
+    wxWinVersion_6 = 0x0600,
+    wxWinVersion_NT6 = 0x0600
+};
+
+WXDLLIMPEXP_BASE wxWinVersion wxGetWinVersion();
+
 #if wxUSE_GUI
 
 // cursor stuff