Share via


IWMPNetwork::getProxyPort 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 getProxyPort method returns the proxy port being used.

Syntax

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

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

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 the proxy port 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 getProxyPort to display the current Windows Media Player proxy port numbers for the MMS and HTTP protocols. The AxWMPLib.AxWindowsMediaPlayer object is represented by the variable named player.

// Variables to hold the results of calls to getProxyPort. 
int proxyPortHTTP = 0;
int proxyPortMMS = 0;

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

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

// Store the proxy port numbers in a string array and display them using a multi-line
// text box. Unavailable proxy port numbers will display as "undefined".
proxyPorts[0] = ("The current HTTP proxy port is: " + proxyPortHTTP.ToString());
proxyPorts[1] = ("The current MMS proxy port is: " + proxyPortMMS.ToString());
proxyPortText.Lines = proxyPorts;

' Variables to hold the results of calls to getProxyPort. 
Dim proxyPortHTTP As Integer = 0
Dim proxyPortMMS As Integer = 0

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

    proxyPortHTTP = player.network.getProxyPort("HTTP")

End If

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

    proxyPortMMS = player.network.getProxyPort("MMS")

End If

' Store the proxy port numbers in a string array and display them using a multi-line
' text box. Unavailable proxy port numbers will display as "undefined".
proxyPorts(0) = ("The current HTTP proxy port is: " + proxyPortHTTP.ToString())
proxyPorts(1) = ("The current MMS proxy port is: " + proxyPortMMS.ToString())
proxyPortText.Lines = proxyPorts

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