Compartir a través de


IWMPNetwork::getProxySettings 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 getProxySettings method returns information about the proxy settings for a protocol.

Syntax

public System.Int32 getProxySettings(
  System.String bstrProtocol
);

Public Function getProxySettings( _
  ByVal bstrProtocol As System.String _
) As System.Int32
Implements IWMPNetwork.getProxySettings

Parameters

bstrProtocol [in]

A System.String that is the protocol name. For a list of supported protocols, see Supported Protocols and File Types.

Return value

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

Value Description
0 A proxy server is not being used.
1 The proxy settings for the current browser are being used (valid only for HTTP).
2 The manually specified proxy settings are being used.
3 The proxy settings are being auto-detected.

Remarks

This method fails unless the calling application is running on the local computer or intranet.

Examples

The following code example uses getProxySettings to display a message, which gives information about the current proxy settings of the Player, in a label. The AxWMPLib.AxWindowsMediaPlayer object is represented by the variable named player.

// Retrieve a number representing the current proxy settings.
int proxySetting = player.network.getProxySettings("MMS");

// Display the message that corresponds to the current settings.
switch(proxySetting)
{
    case 0:
    proxySettingsLabel.Text = "A proxy server is not being used";
    break;

    case 1: 
    proxySettingsLabel.Text = "The proxy settings for the current browser are being used.";
    break;

    case 2:
    proxySettingsLabel.Text = "The manually specified proxy settings are being used.";
    break;

    case 3:
    proxySettingsLabel.Text = "The proxy settings are being auto-detected.";
    break;

    default:
    proxySettingsLabel.Text = "Unable to determine proxy setting, try again.";
    break;
}

' Retrieve a number representing the current proxy settings.
Dim proxySetting As Integer = player.network.getProxySettings("MMS")

' Display the message that corresponds to the current settings.
Select Case proxySetting

    Case 0
        proxySettingsLabel.Text = "A proxy server is not being used"

    Case 1
        proxySettingsLabel.Text = "The proxy settings for the current browser are being used."

    Case 2
        proxySettingsLabel.Text = "The manually specified proxy settings are being used."

    Case 3
        proxySettingsLabel.Text = "The proxy settings are being auto-detected."

    Case Else
        proxySettingsLabel.Text = "Unable to determine proxy setting, try again."

End Select

Requirements

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

See also

IWMPNetwork Interface (VB and C#)

IWMPNetwork.setProxySettings (VB and C#)