FeatureSupport.IsPresent メソッド
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
指定した機能がシステムにインストールされているかどうかを判断します。
オーバーロード
| 名前 | 説明 |
|---|---|
| IsPresent(Object) |
指定した機能のバージョンがシステムにインストールされているかどうかを判断します。 |
| IsPresent(Object, Version) |
指定した機能の指定したバージョンまたは新しいバージョンがシステムにインストールされているかどうかを判断します。 |
| IsPresent(String, String) |
指定した機能のバージョンがシステムにインストールされているかどうかを判断します。 このメソッドは |
| IsPresent(String, String, Version) |
指定した機能の指定したバージョンまたは新しいバージョンがシステムにインストールされているかどうかを判断します。 このメソッドは |
IsPresent(Object)
指定した機能のバージョンがシステムにインストールされているかどうかを判断します。
public:
virtual bool IsPresent(System::Object ^ feature);
public virtual bool IsPresent(object feature);
abstract member IsPresent : obj -> bool
override this.IsPresent : obj -> bool
Public Overridable Function IsPresent (feature As Object) As Boolean
パラメーター
- feature
- Object
検索する機能。
返品
true 機能が存在する場合。それ以外の場合は false。
実装
例
次のコード例では、LayeredWindows機能のFeatureSupportとクエリの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";
}
// 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
注意 (継承者)
FeatureSupportから継承する場合は、GetVersionPresent(String, String) メソッドをオーバーライドする必要があります。 このメソッドをオーバーライドする場合は、 feature パラメーターに使用するクラスが、 IsPresent(String, String) メソッドでこのパラメーターに使用されるクラスと同じであることを確認します。 2 つの feature パラメーターが異なる場合は、 IsPresent(String, String)もオーバーライドする必要があります。
適用対象
IsPresent(Object, Version)
指定した機能の指定したバージョンまたは新しいバージョンがシステムにインストールされているかどうかを判断します。
public:
virtual bool IsPresent(System::Object ^ feature, Version ^ minimumVersion);
public virtual bool IsPresent(object feature, Version minimumVersion);
abstract member IsPresent : obj * Version -> bool
override this.IsPresent : obj * Version -> bool
Public Overridable Function IsPresent (feature As Object, minimumVersion As Version) As Boolean
パラメーター
- feature
- Object
検索する機能。
返品
true 機能が存在し、そのバージョン番号が指定された最小バージョン番号以上の場合。機能がインストールされていないか、そのバージョン番号が指定された最小数を下回る場合に false します。
実装
注意 (継承者)
FeatureSupportから継承する場合は、GetVersionPresent(String, String) メソッドをオーバーライドする必要があります。 このメソッドをオーバーライドする場合は、 feature パラメーターに使用するクラスが、 IsPresent(String, String) メソッドでこのパラメーターに使用されるクラスと同じであることを確認します。 2 つの feature パラメーターが異なる場合は、 IsPresent(String, String)もオーバーライドする必要があります。
適用対象
IsPresent(String, String)
指定した機能のバージョンがシステムにインストールされているかどうかを判断します。 このメソッドは static。
public:
static bool IsPresent(System::String ^ featureClassName, System::String ^ featureConstName);
public static bool IsPresent(string featureClassName, string featureConstName);
static member IsPresent : string * string -> bool
Public Shared Function IsPresent (featureClassName As String, featureConstName As String) As Boolean
パラメーター
- featureClassName
- String
指定した機能に関する情報を照会するクラスの完全修飾名。 このクラスは、 IFeatureSupport インターフェイスを実装するか、このインターフェイスを実装するクラスから継承する必要があります。
- featureConstName
- String
検索する機能の完全修飾名。
返品
true 指定された機能が存在する場合。指定した機能が存在しない場合、または機能を含む製品がインストールされていない場合に false します。
注釈
機能を含む製品のドキュメントを参照して、 featureClassName に渡す名前と featureConstName パラメーターを決定します。
こちらもご覧ください
適用対象
IsPresent(String, String, Version)
指定した機能の指定したバージョンまたは新しいバージョンがシステムにインストールされているかどうかを判断します。 このメソッドは static。
public:
static bool IsPresent(System::String ^ featureClassName, System::String ^ featureConstName, Version ^ minimumVersion);
public static bool IsPresent(string featureClassName, string featureConstName, Version minimumVersion);
static member IsPresent : string * string * Version -> bool
Public Shared Function IsPresent (featureClassName As String, featureConstName As String, minimumVersion As Version) As Boolean
パラメーター
- featureClassName
- String
指定した機能に関する情報を照会するクラスの完全修飾名。 このクラスは、 IFeatureSupport インターフェイスを実装するか、このインターフェイスを実装するクラスから継承する必要があります。
- featureConstName
- String
検索する機能の完全修飾名。
返品
true 機能が存在し、そのバージョン番号が指定された最小バージョン番号以上の場合。機能がインストールされていないか、そのバージョン番号が指定された最小数を下回る場合に false します。
注釈
機能を含む製品のドキュメントを参照して、 featureClassName に渡す名前と featureConstName パラメーターを決定します。