I want a code to be executed just for Windows-XP but I must check whether the current windows is Windows-XP or not.
wxPlatformInfo windows = wxPlatformInfo::Get();
int winXP[] = { 5,1 };
int winXP64[] = { 5,2 };
if (windows.GetOSMajorVersion() == winXP[0] && windows.GetOSMinorVersion() == winXP[1]) {
wxLogMessage("Windows XP");
} else if (windows.GetOSMajorVersion() == winXP64[0] && windows.GetOSMinorVersion() == winXP64[1]) {
wxLogMessage("Windows XP 64Bit");
}
The previous code gives me the direct way to know the windows version.
is there another short way that gives me the windows version?
But don't forget (== window-XP not >= windows-XP)?
What you already have is about as short as you can get, though you should cache the results from
wxPlatformInfo
:Otherwise, consider using
VerifyVersionInfo()
to let the OS compare the version numbers for you: