Windows Media Player 11 SDK IWMPNetwork.setProxySettings (VB and C#)
Previous | Next |
IWMPNetwork.setProxySettings (VB and C#)
The setProxySettings method specifies the proxy settings for a protocol.
Parameters
bstrProtocol
A System.String that is the protocol name. For a list of supported protocols, see Supported Protocols and File Types.
lProxySetting
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. |
Remarks
This method fails unless the calling application is running on the local computer or intranet.
Example Code
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. 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
FakePre-8255b80f9d084c6bb32367f91e40f8e2-c04dde9df3cf4e39a81a4244098848e7
// 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); }
Requirements
Version: Windows Media Player 9 Series or later
Namespace: WMPLib
Assembly: Interop.WMPLib.dll (automatically generated by Visual Studio)
See Also
Previous | Next |