Article ID: 307394 - Last Review: January 18, 2006 - Revision: 1.3 How to determine the version of Windows by using Visual C++This article was previously published under Q307394 On This PageSUMMARY This article demonstrates how to determine which operating
system is in use on the system where your application is running. It
differentiates between Windows 95, Windows 98, Windows Millennium Edition,
Windows NT 3.51, Windows NT 4.0, Windows 2000, and Windows XP.
RequirementsThis article assumes that you have an intermediate-level understanding of C++ programming.Windows Version DataTo determine the operating system that is running on a given system, the following data is needed:Collapse this table
NOTE: although the code in this article does check for all 32-bit Windows versions, neither Visual Studio .NET nor the .NET Framework is supported on Windows 95 or Windows NT 3.51. Obtain the Operating System InformationCreate a pointer to an OperatingSystem class and assign the current operating system information to it:Determine the Platform IDThe first step in the logical evaluation of the operating system information is to determine which platform is in use, as shown below. This is done by using the PlatformID. PlatformID is a property of the OperatingSystem class. An enumerated value of "Win32Windows" means an operating system of the Windows 9x family of products. "WinNT" indicates an operating system of the Windows NT family.Determine the Specific Windows 9x VersionIf the platform has been determined to be Windows 9x, the major or minor version can be analyzed to determine the specific version, as the following code demonstrates.Determine the Specific Windows NT VersionIf the platform has been determined to be Windows NT, the major or minor version can be analyzed to determine the specific version:Building the ExampleThe following steps show how you can build a test scenario to demonstrate this functionality.
REFERENCES For more general information about Visual C++ .NET, visit
the following Microsoft Usenet newsgroup and Microsoft Web site: Microsoft.public.dotnet.languages.vc
(http://go.microsoft.com/fwlink/?linkid=5870)
Visual C++ .NET (2002) Support Center (http://support.microsoft.com/default.aspx?xmlid=fh%3ben-us%3bvcnet) | Article Translations
|

Back to the top
