Mazrim
asked on
C++ Windows Program... How to find out what version of Windows the user has? ***EASY QUESTION***
For a project I am doing I need to know what version of Windows the person running the program has? For example, is it Windows 95? Windows NT? Windows XP? ect.....
This is probly really easy, but i could not find the answer anywhere, so please enlighten me!
Thanks in advance!
This is probly really easy, but i could not find the answer anywhere, so please enlighten me!
Thanks in advance!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
> For a project I am doing I need to know what version of Windows the person
> running the program has? For example, is it Windows 95? Windows NT? Windows
> XP? ect.....
>
> This is probly really easy, but i could not find the answer anywhere, so please enlighten me!
Use the Win32 API function "GetVersionEx". It will fill in a struct with all the info you need. Here is how to use it:
http://msdn.microsoft.com/library/en-us/sysinfo/base/getversionex.asp
Here is a wrapper class that I use:
class CVersion : public OSVERSIONINFO
{
// Construction
public:
CVersion()
{
dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
_CTL_DEBUG_FAIL( ::GetVersionEx(this) );
}
};
Hope that helps,
Dex*