Share via


IWMPNetwork::getProxyName 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 getProxyName method returns the name of the proxy server being used.

Syntax

public System.String getProxyName(
  System.String bstrProtocol
);

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

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.String that is the name of the proxy server being used. The value is meaningful only when IWMPNetwork.getProxySettings returns a value of 2 (use manual settings).

Remarks

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

Examples

The following code example uses getProxyName to display the Windows Media Player proxy server names for the HTTP and MMS protocols. The AxWMPLib.AxWindowsMediaPlayer object is represented by the variable named player.

// String values to hold the results of calls to getProxyExceptionList. 
string proxyNameHTTP = "";
string proxyNameMMS = "";

// Test whether the HTTP proxy settings are manual.
if (player.network.getProxySettings("HTTP") == 2)
{
    proxyNameHTTP = player.network.getProxyName("HTTP");
}

// Test whether the MMS proxy settings are manual.
if (player.network.getProxySettings("MMS") == 2)
{
    proxyNameMMS = player.network.getProxyName("MMS");
}

// Store the proxy server names in a string array and display them using a multi-line
// text box. Unavailable proxy server names will display as "undefined".
proxyNames[0] = ("The current HTTP proxy server name is: " + proxyNameHTTP);
proxyNames[1] = ("The current MMS proxy server name is: " + proxyNameMMS);
proxyNameText.Lines = proxyNames;

' String values to hold the results of calls to getProxyExceptionList. 
Dim proxyNameHTTP As String = ""
Dim proxyNameMMS As String = ""

' Test whether the HTTP proxy settings are manual.
If (player.network.getProxySettings("HTTP") = 2) Then

    proxyNameHTTP = player.network.getProxyName("HTTP")

End If

' Test whether the MMS proxy settings are manual.
If (player.network.getProxySettings("MMS") = 2) Then

    proxyNameMMS = player.network.getProxyName("MMS")

End If

' Store the proxy server names in a string array and display them using a multi-line
' text box. Unavailable proxy server names will display as "undefined".
proxyNames(0) = ("The current HTTP proxy server name is: " + proxyNameHTTP)
proxyNames(1) = ("The current MMS proxy server name is: " + proxyNameMMS)
proxyNameText.Lines = proxyNames

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.getProxySettings (VB and C#)

IWMPNetwork.setProxyName (VB and C#)