Partager via


IWMPSettings.isAvailable (VB and C#)

[The feature associated with this page, Windows Media Player SDK, is a legacy feature. It has been superseded by MediaPlayer. MediaPlayer has been optimized for Windows 10 and Windows 11. Microsoft strongly recommends that new code use MediaPlayer instead of Windows Media Player SDK, when possible. Microsoft suggests that existing code that uses the legacy APIs be rewritten to use the new APIs if possible.]

The isAvailable property (the get_isAvailable method in C#) gets a value that indicates whether a specified action can be performed.

[Visual Basic]
ReadOnly Property isAvailable(
  bstrItem As System.String
) As System.Boolean
[C#]
System.Boolean get_isAvailable (
  System.String bstrItem
);

Parameters

bstrItem

A System.String that is one of the following values.

Value Description
AutoStart Discovers whether the autoStart property can be set to specify that Windows Media Player starts playback automatically.
Balance Discovers whether the balance property can be used to set the stereo balance.
BaseURL Discovers whether the baseURL property can be set to specify a base URL.
DefaultFrame Discovers whether the defaultFrame property can be set to specify the default frame.
EnableErrorDialogs Discovers whether the enableErrorDialogs property can be set to enable or disable displaying error dialog boxes.
GetMode Discovers whether the getMode method can be used to retrieve the current loop or shuffle mode.
InvokeURLs Discovers whether the invokeURLs property can be set to specify whether URL events should launch a Web browser.
Mute Discovers whether the mute property can be set to specify whether the audio output is on or off.
PlayCount Discovers whether the playCount property can be set to specify the number times a media item will play.
Rate Discovers whether the rate property can be set to control the playback rate.
SetMode Discovers whether the setMode method can be used to specify the current loop or shuffle mode.
Volume Discovers whether the volume property can be set to specify the audio volume.

Property Value

A System.Boolean value indicating whether the specified action can be performed.

Remarks

IWMPSettings.isIdentical is a property in Visual Basic that takes a parameter. In C# it is referred to as the IWMPSettings.get_isIdentical method.

Examples

The following example tests each of the IWMPSettings properties using the isAvailable property (the get_isAvailable method in C#). The property name and the result of each test are displayed in a multi-line text box. The AxWMPLib.AxWindowsMediaPlayer object is represented by the variable named 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) { _
    &quot;AutoStart&quot;, &quot;Balance&quot;, &quot;BaseURL&quot;, &quot;DefaultFrame&quot;, &quot;EnableErrorDialogs&quot;, _
    &quot;GetMode&quot;, &quot;InvokeURLs&quot;, &quot;Mute&quot;, &quot;PlayCount&quot;, &quot;Rate&quot;, &quot;SetMode&quot;, &quot;Volume&quot; _
}

&#39;  Create another string array of the same size to hold the result of each
&#39;  call to get_isAvailable.
Dim results(12) As String

&#39;  Test each property using isAvailable and add the name of the property
&#39;  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) + &quot; = &quot; + isAvailable.ToString())

Next i

&#39;  Display the results in a multi-line text box.
playerSettings.Lines = results

Requirements

Requirement Value
Version
Windows Media Player 9 Series or later
Namespace
WMPLib
Assembly
Interop.WMPLib.dll (Interop.WMPLib.dll.dll)

See also

IWMPSettings Interface (VB and C#)

IWMPSettings.autoStart (VB and C#)

IWMPSettings.balance (VB and C#)

IWMPSettings.baseURL (VB and C#)

IWMPSettings.defaultFrame (VB and C#)

IWMPSettings.enableErrorDialogs (VB and C#)

IWMPSettings.getMode (VB and C#)

IWMPSettings.invokeURLs (VB and C#)

IWMPSettings.mute (VB and C#)

IWMPSettings.playCount (VB and C#)

IWMPSettings.rate (VB and C#)

IWMPSettings.setMode (VB and C#)

IWMPSettings.volume (VB and C#)