IFeatureSupport 介面
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
規範一個標準介面,用於從目前系統擷取特徵資訊。
public interface class IFeatureSupport
public interface IFeatureSupport
type IFeatureSupport = interface
Public Interface IFeatureSupport
- 衍生
範例
以下範例使用 OSFeature 了該功能的實作 IFeatureSupport 與查詢 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";
}
// 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
備註
在類別中實作時, IFeatureSupport 提供方法,讓你能判斷某功能是否已安裝在系統上,並取得該功能的版本號。 請致電 IsPresent 確認目前是否安裝了某個功能,或是某個特定版本的功能。 打電話 GetVersionPresent 查詢已安裝功能的版本號。
請參閱 FeatureSupport 和 OSFeature 類別以了解此介面的實作。
方法
| 名稱 | Description |
|---|---|
| GetVersionPresent(Object) |
取得指定功能的版本。 |
| IsPresent(Object, Version) |
判斷該功能目前是否可用指定或更新版本的功能。 |
| IsPresent(Object) |
判斷系統中是否目前有指定功能的任何版本可用。 |