How Do Your .NET Applications Know If They’re Running Under Windows 7?

Sometimes it’s the little things that seem to drive ya nuts while developing an application. This is a follow up post to a my How Do Your .NET Applications Know if They're Running Under Vista? post from September 2008.
There are features in Windows 7 that are NOT available in earlier versions of Windows so there may be times when you need to know what OS your application is running under. Determining the OS version is as simple as checking a few properties on the the System.Environment.OSVersion object. For Windows 7 you will want to confirm the build number as well as the major and minor version values.

If System.Environment.OSVersion.Version.Build >= 7600 And 
    System.Environment.OSVersion.Version.Major >= 6 And 
    System.Environment.OSVersion.Version.Minor >= 1 Then 
     ‘Windows 7 specific code here
End If 
Seems simple enough.
Have a day. :-|

posted on Sunday, October 18, 2009 1:07 PM Print
Comments are closed.
Comments have been closed on this topic.