IWMPNetwork :: getProxyPort, méthode
La méthode getProxyPort retourne le port proxy utilisé.
Syntaxe
public System.Int32 getProxyPort(
System.String bstrProtocol
);
Public Function getProxyPort( _
ByVal bstrProtocol As System.String _
) As System.Int32
Implements IWMPNetwork.getProxyPort
Paramètres
-
bstrProtocol [ dans]
-
System. String qui est le nom de protocole. Pour obtenir la liste des protocoles pris en charge, consultez protocoles et types de fichiers pris en charge.
Valeur de retour
System. Int32 qui est le port proxy utilisé. La valeur est significative uniquement lorsque IWMPNetwork. getProxySettings retourne la valeur 2 (utiliser des paramètres manuels).
Notes
Cette méthode échoue sauf si l’application appelante est en cours d’exécution sur l’ordinateur local ou sur l’intranet.
Exemples
l’exemple de code suivant utilise getProxyPort pour afficher les numéros de port de proxy Lecteur Windows Media actuels pour les protocoles MMS et HTTP. L’objet AxWMPLib. AxWindowsMediaPlayer est représenté par la variable 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
Spécifications
| Condition requise | Valeur |
|---|---|
| Version |
Lecteur Windows Media série 9 ou version ultérieure |
| Espace de noms |
WMPLib |
| Assembly |
|