Posts
256
Comments
463
Trackbacks
17
How Do Your .NET Applications Know if They're Running Under Vista?

There are features in Vista that are NOT available in earlier version 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 the System.Environment.OSVersion object.

If System.Environment.OSVersion.Version.Major >= 6 Then

'Vista specific code here

Else

'Earlier versions of Windows code here

End If

 

There are a number of other useful pieces of information in the System.Environment namespace such as GetFolderPath which returns the path of the special system folder based on the enum specified. For example, this code returns the location of the My Documents folder.

x = System.Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)

 

Have a day. :-|

posted on Wednesday, September 24, 2008 11:10 AM Print
Comments
Gravatar
# re: How Do Your .NET Applications Know if They're Running Under Vista?
Chris Love
9/24/2008 1:03 PM
Great tidbit!!! Nice to see it is that easy.
Gravatar
# re: How Do Your .NET Applications Know if They're Running Under Vista?
jaredpar
9/24/2008 3:46 PM
Unfortunately this will also be true for anything after vista including W2K8 and presumably the next version of Windows. So it won't be Vista specific but rather Vista or later
Gravatar
# re: How Do Your .NET Applications Know if They're Running Under Vista?
in-tips
5/2/2009 8:09 PM
Wow .. great post
Gravatar
# re: How Do Your .NET Applications Know if They're Running Under Vista?
Souvenir Pernikahan
5/4/2009 12:53 AM
good job.
thanks for your sharing
Gravatar
# re: How Do Your .NET Applications Know if They're Running Under Vista?
Jhon
5/5/2009 12:26 PM
Good article. Thank you so much.
Comments have been closed on this topic.