IWMPSettings.isAvailable (VB 和 C#)
[與此頁面相關聯的功能Windows 媒體播放機 SDK是舊版功能。 MediaPlayer已取代它。 MediaPlayer已針對Windows 10和Windows 11進行優化。 Microsoft 強烈建議新程式碼盡可能使用MediaPlayer,而不是Windows 媒體播放機 SDK。 Microsoft 建議使用舊版 API 的現有程式碼盡可能重寫為使用新的 API。
isAvailable屬性 (C# 中get_isAvailable方法) 取得值,指出是否可以執行指定的動作。
[Visual Basic]
ReadOnly Property isAvailable(
bstrItem As System.String
) As System.Boolean
[C#]
System.Boolean get_isAvailable (
System.String bstrItem
);
參數
bstrItem
System.String,這是下列其中一個值。
值 | 描述 |
---|---|
AutoStart | 探索 autoStart 屬性是否可以設定為指定Windows 媒體播放機自動開始播放。 |
餘額 | 探索平衡屬性是否可以用來設定立體平衡。 |
BaseURL | 探索是否可以設定 baseURL 屬性來指定基底 URL。 |
DefaultFrame | 探索是否可以設定 defaultFrame 屬性來指定預設框架。 |
EnableErrorDialogs | 探索 enableErrorDialogs 屬性是否可以設定為啟用或停用顯示錯誤對話方塊。 |
GetMode | 探索 getMode 方法是否可用來擷取目前的迴圈或隨機模式。 |
InvokeURLs | 探索是否可設定 invokeURLs 屬性,以指定 URL 事件是否應該啟動網頁瀏覽器。 |
Mute | 探索是否可以設定 Mute 屬性,以指定音訊輸出是否開啟或關閉。 |
PlayCount | 探索 playCount 屬性是否可以設定為指定媒體專案將播放的次數。 |
費率 | 探索是否可設定 rate 屬性來控制播放速率。 |
SetMode | 探索 setMode 方法是否可用來指定目前的迴圈或隨機模式。 |
磁碟區 | 探索是否可以設定音量屬性來指定音訊音量。 |
屬性值
System.Boolean值,指出是否可以執行指定的動作。
備註
IWMPSettings.isIdentical 是 Visual Basic 中採用 參數的屬性。 在 C# 中,稱為 IWMPSettings.get_isIdentical 方法。
範例
下列範例會使用isAvailable屬性來測試每個IWMPSettings屬性, (C#) 中的 get_isAvailable方法。 屬性名稱和每個測試的結果會顯示在多行文字方塊中。 AxWMPLib.AxWindowsMediaPlayer物件是由名為 player 的變數表示。
// Create a string array that contains a list of IWMPSettings properties.
string[] propertyList = new string[12]{
"AutoStart", "Balance", "BaseURL", "DefaultFrame", "EnableErrorDialogs",
"GetMode", "InvokeURLs", "Mute", "PlayCount", "Rate", "SetMode", "Volume"
};
// Create another string array of the same size to hold the result of each
// call to get_isAvailable.
string[] results = new string[12];
// Test each property using get_isAvailable and add the name of the property
// and the result of the test to the results array.
for (int i = 0; i < propertyList.Length; i++)
{
bool isAvailable = player.settings.get_isAvailable(propertyList[i]);
results[i] = (propertyList[i] + " = " + isAvailable.ToString());
}
// Display the results in a multi-line text box.
playerSettings.Lines = results;
' Create a string array that contains a list of IWMPSettings properties.
Dim propertyList As String() = New String(11) { _
"AutoStart", "Balance", "BaseURL", "DefaultFrame", "EnableErrorDialogs", _
"GetMode", "InvokeURLs", "Mute", "PlayCount", "Rate", "SetMode", "Volume" _
}
' Create another string array of the same size to hold the result of each
' call to get_isAvailable.
Dim results(12) As String
' Test each property using isAvailable and add the name of the property
' and the result of the test to the results array.
For i As Integer = 0 To (propertyList.Length - 1)
Dim isAvailable As Boolean = player.settings.isAvailable(propertyList(i))
results(i) = (propertyList(i) + " = " + isAvailable.ToString())
Next i
' Display the results in a multi-line text box.
playerSettings.Lines = results
規格需求
需求 | 值 |
---|---|
版本 |
Windows 媒體播放機 9 系列或更新版本 |
命名空間 |
WMPLib |
組件 |
|
另請參閱
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應