Metodo IWMPNetwork::getProxyPort

[La funzionalità associata a questa pagina, Lettore multimediale Windows SDK, è una funzionalità legacy. È stato sostituito da MediaPlayer. MediaPlayer è stato ottimizzato per Windows 10 e Windows 11. Microsoft consiglia vivamente che il nuovo codice usi MediaPlayer invece di Lettore multimediale Windows SDK, quando possibile. Microsoft suggerisce che il codice esistente che usa le API legacy venga riscritto per usare le nuove API, se possibile.

Il metodo getProxyPort restituisce la porta proxy in uso.

Sintassi

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

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

Parametri

bstrProtocol [in]

System.String che rappresenta il nome del protocollo. Per un elenco dei protocolli supportati, vedere Protocolli e tipi di file supportati.

Valore restituito

System.Int32 che rappresenta la porta proxy usata. Il valore è significativo solo quando IWMPNetwork.getProxySettings restituisce un valore pari a 2 (usare le impostazioni manuali).

Commenti

Questo metodo non riesce a meno che l'applicazione chiamante non sia in esecuzione nel computer locale o nella intranet.

Esempio

Nell'esempio di codice seguente viene usato getProxyPort per visualizzare i numeri di porta proxy Lettore multimediale Windows correnti per i protocolli MMS e HTTP. L'oggetto AxWMPLib.AxWindowsMediaPlayer è rappresentato dalla variabile denominata 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

Requisiti

Requisito Valore
Versione
Lettore multimediale Windows serie 9 o successive
Spazio dei nomi
WMPLib
Assembly
Interop.WMPLib.dll (Interop.WMPLib.dll.dll)

Vedi anche

Interfaccia IWMPNetwork (VB e C#)

IWMPNetwork.getProxySettings (VB e C#)

IWMPNetwork.setProxyPort (VB e C#)