OSFeature.GetVersionPresent(Object) 方法

定义

检索当前系统上可用的指定功能的版本。

public:
 override Version ^ GetVersionPresent(System::Object ^ feature);
public override Version GetVersionPresent (object feature);
public override Version? GetVersionPresent (object feature);
override this.GetVersionPresent : obj -> Version
Public Overrides Function GetVersionPresent (feature As Object) As Version

参数

feature
Object

请求其版本的功能,为 LayeredWindowsThemes

返回

Version 表示系统上当前可用的指定操作系统功能的版本;如果找不到该功能,则为 null

示例

以下示例查询OSFeatureLayeredWindows功能。 检查版本以查看它是否为 null,以确定功能是否存在。 结果显示在文本框中。 此代码假定 textBox1 已创建并放置在窗体上。

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";
      }
   }
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 != null)
      textBox1.Text = "Layered windows feature is installed.\n";
   else
      textBox1.Text = "Layered windows feature is not installed.\n";
}
Private Sub LayeredWindows()
    ' Gets the version of the layered windows feature.
    Dim myVersion As Version = _
       OSFeature.Feature.GetVersionPresent(OSFeature.LayeredWindows)
       
    ' Prints whether the feature is available.
    If (myVersion IsNot Nothing) Then
        textBox1.Text = "Layered windows feature is installed." & _
           ControlChars.CrLf
    Else
        textBox1.Text = "Layered windows feature is not installed." & _
           ControlChars.CrLf
    End If
End Sub

注解

Feature使用 属性(static此类中提供的 实例OSFeature)查询功能的版本号。

适用于

另请参阅