OSFeature クラス

定義

オペレーティング システム固有の機能についてのクエリを提供します。

public ref class OSFeature : System::Windows::Forms::FeatureSupport
public class OSFeature : System.Windows.Forms.FeatureSupport
type OSFeature = class
    inherit FeatureSupport
Public Class OSFeature
Inherits FeatureSupport
継承

次の例では、 を使用 OSFeature してオペレーティング システムに対してクエリを実行し、機能が LayeredWindows インストールされているかどうかを判断します。 この例では、機能が存在するかどうかを確認する 2 つの異なる方法を示します。 最初のメソッドでは、 myVersion が かどうかを確認します null。 バージョン nullが の場合、この機能はインストールされません。 2 番目のメソッドでは、基本クラス メソッド IsPresent を呼び出して、機能がインストールされているかどうかを確認します。 結果はテキスト ボックスに表示されます。

このコードは、フォームが 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";
      }

      
      // 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." );
      }
   }
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';

   // This is an alternate way to check whether a feature is present.
   if (OSFeature.Feature.IsPresent(OSFeature.LayeredWindows))
      textBox1.Text += "Again, layered windows feature is installed.";
   else
      textBox1.Text += "Again, layered windows feature is not installed.";
}
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 
    'This is an alternate way to check whether a feature is present.
    If OSFeature.Feature.IsPresent(OSFeature.LayeredWindows) Then
        textBox1.Text &= "Again, layered windows feature is installed."
    Else
        textBox1.Text &= "Again, layered windows feature is not installed."
    End If
End Sub

注釈

プロパティで static 提供されているこのクラスのインスタンスを Feature 使用して、オペレーティング システム機能のクエリを実行します。 このクラスのインスタンスを作成することはできません。

機能のバージョンを確認するには、 メソッドを呼び出します GetVersionPresent 。 機能または特定のバージョンが存在するかどうかを判断するには、 メソッドを IsPresent 呼び出し、このクラスで提供されている機能識別子を使用して検索する機能を指定します。

コンストラクター

OSFeature()

OSFeature クラスの新しいインスタンスを初期化します。

フィールド

LayeredWindows

レイヤード トップレベル ウィンドウ機能を表します。 このフィールドは読み取り専用です。

Themes

オペレーティング システムのテーマ機能を表します。 このフィールドは読み取り専用です。

プロパティ

Feature

機能の問い合わせに使用する OSFeature クラスの static インスタンスを取得します。 このプロパティは読み取り専用です。

メソッド

Equals(Object)

指定されたオブジェクトが現在のオブジェクトと等しいかどうかを判断します。

(継承元 Object)
GetHashCode()

既定のハッシュ関数として機能します。

(継承元 Object)
GetType()

現在のインスタンスの Type を取得します。

(継承元 Object)
GetVersionPresent(Object)

システムで現在使用できる、指定した機能のバージョンを取得します。

IsPresent(Object)

指定した機能の任意のバージョンがシステムにインストールされているかどうかを判断します。

(継承元 FeatureSupport)
IsPresent(Object, Version)

指定した機能の指定したバージョン、またはそれよりも新しいバージョンがシステムにインストールされているかどうかを判断します。

(継承元 FeatureSupport)
IsPresent(SystemParameter)

オペレーティング システムが、指定した機能またはメトリックをサポートしているかどうかを示す値を取得します。

MemberwiseClone()

現在の Object の簡易コピーを作成します。

(継承元 Object)
ToString()

現在のオブジェクトを表す文字列を返します。

(継承元 Object)

適用対象

こちらもご覧ください