OSFeature.GetVersionPresent(Object) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
擷取目前系統上可用的指定功能的版本。
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
備註
Feature使用 屬性, static
這個類別中提供的 實例 OSFeature ,查詢功能的版本號碼。