次の方法で共有


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

次の例では、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

注釈

このクラスで提供されるOSFeaturestatic インスタンスである Feature プロパティを使用して、機能のバージョン番号を照会します。

適用対象

こちらもご覧ください