共用方式為


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

範例

下列範例會 LayeredWindows 查詢 OSFeature 功能。 系統會檢查版本,以查看其是否為 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 ,查詢功能的版本號碼。

適用於

另請參閱