NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

OSFeature Class

Provides operating-system specific feature queries.

Object
   FeatureSupport
      OSFeature

[Visual Basic]
Public Class OSFeature
   Inherits FeatureSupport
[C#]
public class OSFeature : FeatureSupport
[C++]
public __gc class OSFeature : public FeatureSupport
[JScript]
public class OSFeature extends FeatureSupport

Remarks

To query for operating system features, use the static (in Visual Basic Shared), read-only field feature. To determine the version of a feature, call the GetVersionPresent method of feature. To determine if a feature, or a specific version, is present, call the base class IsPresent method of feature. Specify the feature to look for with the feature identifiers provided in this class.

Requirements

Namespace: System.WinForms

Assembly: System.WinForms.dll

Example [Visual Basic]

The following example queries OSFeature for the LAYERED_WINDOWS feature.

The example presents two different methods of checking to see whether the feature is present. First the version is checked to see if it is a null reference (in Visual Basic Nothing). Then example calls the base classes IsPresent method to see if the feature is installed. The results are displayed in a text box.

This code assumes Button1 and TextBox1 have been instantiated.

[Visual Basic]

Private Sub LayeredWindows()
   'Get the version of the layered windows feature.
   Dim myVersion As Version
   myVersion = OSFeature.feature.GetVersionPresent(OSFeature.LAYERED_WINDOWS)

   'Print whether the feature is available.
   If (myVersion = Nothing) Then
      TextBox1.Text = "Layered windows feature is not installed."
   Else
      TextBox1.Text = "Layered windows feature is installed."
   End If

   'This is an alternate means of checking whether a feature is present
   If (OSFeature.feature.IsPresent("OSFeature.LAYERED_WINDOWS")) Then
      TextBox1.Text &= "Again, layered windows feature is installed."
   Else
      TextBox1.Text &= "Again, layered windows feature is not installed."
   End If
End Sub

See Also

OSFeature Members | System.WinForms Namespace