Discussion:
in VC++, can you determine if running under Vista OS?
(too old to reply)
kodecharlie
2008-07-23 22:00:05 UTC
Permalink
Is there some way in VC++ to determine whether your application is
running under Vista OS?

Thanks,
kodecharlie
Nathan Mates
2008-07-23 22:36:02 UTC
Permalink
Post by kodecharlie
Is there some way in VC++ to determine whether your application is
running under Vista OS?
This is what GetVersionEx() is for:

OSVERSIONINFO verInfo;
verInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
GetVersionEx(&verInfo);
bool isVistaOrNewer = (verInfo.dwMajorVersion > 5);

Nathan Mates
--
<*> Nathan Mates - personal webpage http://www.visi.com/~nathan/
# Programmer at Pandemic Studios -- http://www.pandemicstudios.com/
# NOT speaking for Pandemic Studios. "Care not what the neighbors
# think. What are the facts, and to how many decimal places?" -R.A. Heinlein
Chuck Walbourn [MSFT]
2008-08-20 23:47:24 UTC
Permalink
The main thing to remember about OS version checks is that they are the #1
source of appliication compatability bugs with every new release of Windows.
In general, we recommend that you don't use them.

Why are you trying to detect the OS? What behavior change in your program
will you take depending on this result?
--
Chuck Walbourn
SDE, XNA Developer Connection

This posting is provided "AS IS" with no warranties, and confers no rights.
Loading...