From 4c5da5e42d54e0d660a04f4160c60b27090656c8 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 7 Jun 2005 13:29:43 +0000 Subject: [PATCH] added wxGetWinVersion() git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@34571 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/msw/private.h | 37 ++++++++++++++++++++++++++ src/msw/utils.cpp | 56 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 93 insertions(+) diff --git a/include/wx/msw/private.h b/include/wx/msw/private.h index 203f6a25b6..883ad9932c 100644 --- a/include/wx/msw/private.h +++ b/include/wx/msw/private.h @@ -701,6 +701,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 +}; + +extern wxWinVersion wxGetWinVersion(); + #if wxUSE_GUI // cursor stuff diff --git a/src/msw/utils.cpp b/src/msw/utils.cpp index d0a591dab4..3fea3de8d7 100644 --- a/src/msw/utils.cpp +++ b/src/msw/utils.cpp @@ -1241,6 +1241,62 @@ wxToolkitInfo& wxAppTraits::GetToolkitInfo() return info; } +wxWinVersion wxGetWinVersion() +{ + int verMaj, + verMin; + switch ( wxGetOsVersion(&verMaj, &verMin) ) + { + case wxWIN95: + if ( verMaj == 4 ) + { + switch ( verMin ) + { + case 0: + return wxWinVersion_95; + + case 10: + return wxWinVersion_98; + + case 90: + return wxWinVersion_ME; + } + } + break; + + case wxWINDOWS_NT: + switch ( verMaj ) + { + case 3: + return wxWinVersion_NT3; + + case 4: + return wxWinVersion_NT4; + + case 5: + switch ( verMin ) + { + case 0: + return wxWinVersion_2000; + + case 1: + return wxWinVersion_XP; + + case 2: + return wxWinVersion_2003; + } + break; + + case 6: + return wxWinVersion_NT6; + } + break; + + } + + return wxWinVersion_Unknown; +} + // ---------------------------------------------------------------------------- // sleep functions // ---------------------------------------------------------------------------- -- 2.45.2