IWMPNetwork::setProxySettings method
[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 setProxySettings method specifies the proxy settings for a protocol.
Syntax
public void setProxySettings(
System.String bstrProtocol,
System.Int32 lProxySetting
);
Public Sub setProxySettings( _
ByVal bstrProtocol As System.String, _
ByVal lProxySetting As System.Int32 _
)
Implements IWMPNetwork.setProxySettings
Parameters
-
bstrProtocol [in]
-
A System.String that is the protocol name. For a list of supported protocols, see Supported Protocols and File Types.
-
lProxySetting [in]
-
A System.Int32 that is one of the following values.
Value Description 0 Do not use a proxy server. 1 Use the proxy settings of the current browser (valid only for HTTP). 2 Use the manually specified proxy settings. 3 Auto-detect the proxy settings.
Return value
This method does not return a value.
Remarks
This method fails unless the calling application is running on the local computer or intranet.
Examples
The following code example uses a list box to allow the user to set the Windows Media Player proxy setting for the HTTP protocol. The AxWMPLib.AxWindowsMediaPlayer object is represented by the variable named player.
// Load the list box with the proxy settings in order so that their index in the
// list box matches their value.
proxySettings.Items.Add("Do not use a proxy server. (Value = 0)");
proxySettings.Items.Add("Use the proxy settings of the current browser. Valid for HTTP only. (Value = 1)");
proxySettings.Items.Add("Use the manually specified proxy settings. (Value = 2)");
proxySettings.Items.Add("Auto-detect the proxy settings. (Value = 3)");
// Change the proxy setting for the HTTP protocol when the user makes a list box selection.
private void proxySettings_OnSelectedIndexChanged(object sender, System.EventArgs e)
{
// Store the index of the setting from the ListBox
int setting = ((System.Windows.Forms.ListBox)sender).SelectedIndex;
// Change the proxy setting.
player.network.setProxySettings("HTTP", setting);
}
' Load the list box with the proxy settings in order so that their index in the
' list box matches their value.
proxySettings.Items.Add("Do not use a proxy server. (Value = 0)")
proxySettings.Items.Add("Use the proxy settings of the current browser. Valid for HTTP only. (Value = 1)")
proxySettings.Items.Add("Use the manually specified proxy settings. (Value = 2)")
proxySettings.Items.Add("Auto-detect the proxy settings. (Value = 3)")
' Change the proxy setting for the HTTP protocol when the user makes a list box selection.
Public Sub proxySettings_OnSelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles proxySettings.SelectedIndexChanged
' Store the index of the setting from the ListBox
Dim lb As System.Windows.Forms.ListBox = sender
Dim setting As Integer = lb.SelectedIndex
' Change the proxy setting.
player.network.setProxySettings("HTTP", setting)
End Sub
Requirements
Requirement | Value |
---|---|
Version |
Windows Media Player 9 Series or later |
Namespace |
WMPLib |
Assembly |
|