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

バージョンが要求されている機能。LayeredWindows または Themes です。

戻り値

システムで現在使用できる、指定したオペレーティング システムの機能のバージョンを表す Version。機能が見つからない場合は null

次の例では、この機能のクエリ OSFeature を実行 LayeredWindows します。 バージョンが かどうかを確認して、 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 提供される staticOSFeature インスタンスである プロパティを使用して、機能のバージョン番号を照会します。

適用対象

こちらもご覧ください