FeatureSupport.IsPresent メソッド
指定した機能がシステムにインストールされているかどうかを判断します。
オーバーロードの一覧
指定した機能の任意のバージョンがシステムにインストールされているかどうかを判断します。
[Visual Basic] Overloads Public Overridable Function IsPresent(Object) As Boolean Implements IFeatureSupport.IsPresent
指定した機能の指定したバージョン、またはそれよりも新しいバージョンがシステムにインストールされているかどうかを判断します。
[Visual Basic] Overloads Public Overridable Function IsPresent(Object, Version) As Boolean Implements IFeatureSupport.IsPresent
[JScript] public function IsPresent(Object, Version) : Boolean;
指定した機能の任意のバージョンがシステムにインストールされているかどうかを判断します。このメソッドは静的 (Visual Basic の場合は Shared) です。
[Visual Basic] Overloads Public Shared Function IsPresent(String, String) As Boolean
[JScript] public static function IsPresent(String, String) : Boolean;
指定した機能の指定したバージョン、またはそれよりも新しいバージョンがシステムにインストールされているかどうかを判断します。このメソッドは静的 (Visual Basic の場合は Shared) です。
[Visual Basic] Overloads Public Shared Function IsPresent(String, String, Version) As Boolean
[C++] public: static bool IsPresent(String*, String*, Version*);
[JScript] public static function IsPresent(String, String, Version) : Boolean;
使用例
[Visual Basic, C#, C++] FeatureSupport の OSFeature 実装を使用し、 LayeredWindows 機能の有無を問い合わせる例を次に示します。機能が存在するかどうかを確認するには、バージョンが null 参照 (Visual Basic では Nothing) かどうかを調べます。結果はテキスト ボックスに表示されます。このコードは、 textBox1
が作成され、フォーム上に配置されていることを前提にしています。
[Visual Basic, C#, C++] メモ ここでは、IsPresent のオーバーロード形式のうちの 1 つだけについて、使用例を示します。その他の例については、各オーバーロード形式のトピックを参照してください。
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 Not (myVersion Is 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
[C#]
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.";
}
[C++]
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 != 0)
textBox1->Text = S"Layered windows feature is installed.\n";
else
textBox1->Text = S"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, S"Again, layered windows feature is installed." );
else
textBox1->Text = String::Concat( textBox1->Text, S"Again, layered windows feature is not installed." );
}
[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン をクリックします。
参照
FeatureSupport クラス | FeatureSupport メンバ | System.Windows.Forms 名前空間