FeatureSupport Class
Provides static methods for retrieving feature information from the current system.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
The FeatureSupport type exposes the following members.
| Name | Description | |
|---|---|---|
![]() | Equals(Object) | Determines whether the specified Object is equal to the current Object. (Inherited from Object.) |
![]() | Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) |
![]() | GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) |
![]() | GetType | Gets the Type of the current instance. (Inherited from Object.) |
![]() | GetVersionPresent(Object) | When overridden in a derived class, gets the version of the specified feature that is available on the system. |
![]() ![]() | GetVersionPresent(String, String) | Gets the version of the specified feature that is available on the system. |
![]() | IsPresent(Object) | Determines whether any version of the specified feature is installed in the system. |
![]() | IsPresent(Object, Version) | Determines whether the specified or newer version of the specified feature is installed in the system. |
![]() ![]() | IsPresent(String, String) | Determines whether any version of the specified feature is installed in the system. This method is static. |
![]() ![]() | IsPresent(String, String, Version) | Determines whether the specified or newer version of the specified feature is installed in the system. This method is static. |
![]() | MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) |
![]() | ToString | Returns a string that represents the current object. (Inherited from Object.) |
Use the static methods of this class when the classes you query for feature information implement the IFeatureSupport interface. Otherwise, inherit from FeatureSupport and provide your own implementation. For an implementation of this class, see OSFeature.
To get the version number of a feature, call GetVersionPresent. Call IsPresent to determine if a particular feature or version of a feature is installed.
Notes to InheritorsWhen you inherit from FeatureSupport, you must override the GetVersionPresent method. When you override this method, check that the class that you use for the feature parameter is the same as the class used for this parameter in the IsPresent method. If the two feature parameters differ, you also must override IsPresent.
The following example uses the OSFeature implementation of FeatureSupport and queries for the LayeredWindows feature. The version is checked to see if it is nullptr, to determine whether the feature is present. The result is displayed in a text box. This code assumes textBox1 has been created and placed on a form.
private: void LayeredWindows() { // Gets the version of the layered windows feature. Version^ myVersion = OSFeature::Feature->GetVersionPresent( OSFeature::LayeredWindows ); // Prints whether the feature is available. if ( myVersion != nullptr ) { textBox1->Text = "Layered windows feature is installed.\n"; } else { textBox1->Text = "Layered windows feature is not installed.\n"; } // This is an alternate way to check whether a feature is present. if ( OSFeature::Feature->IsPresent( OSFeature::LayeredWindows ) ) { textBox1->Text = String::Concat( textBox1->Text, "Again, layered windows feature is installed." ); } else { textBox1->Text = String::Concat( textBox1->Text, "Again, layered windows feature is not installed." ); } }
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
