IWMPNetwork :: Setproxysettings n', méthode
La méthode setproxysettings n' spécifie les paramètres de proxy pour un protocole.
Syntaxe
public void setProxySettings(
System.String bstrProtocol,
System.Int32 lProxySetting
);
Public Sub setProxySettings( _
ByVal bstrProtocol As System.String, _
ByVal lProxySetting As System.Int32 _
)
Implements IWMPNetwork.setProxySettings
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.
-
lProxySetting [ dans]
-
System. Int32 qui est l’une des valeurs suivantes.
Valeur Description 0 N’utilisez pas de serveur proxy. 1 Utilisez les paramètres de proxy du navigateur actuel (valide uniquement pour HTTP). 2 Utilisez les paramètres de proxy spécifiés manuellement. 3 Détectez automatiquement les paramètres du proxy.
Valeur de retour
Cette méthode ne retourne pas de valeur.
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 une zone de liste pour permettre à l’utilisateur de définir le paramètre de proxy Lecteur Windows Media pour le protocole HTTP. L’objet AxWMPLib. AxWindowsMediaPlayer est représenté par la variable Player.
// Load the list box with the proxy settings in order so that their index in the
// list box matches their value.
proxySettings.Items.Add("Do not use a proxy server. (Value = 0)");
proxySettings.Items.Add("Use the proxy settings of the current browser. Valid for HTTP only. (Value = 1)");
proxySettings.Items.Add("Use the manually specified proxy settings. (Value = 2)");
proxySettings.Items.Add("Auto-detect the proxy settings. (Value = 3)");
// Change the proxy setting for the HTTP protocol when the user makes a list box selection.
private void proxySettings_OnSelectedIndexChanged(object sender, System.EventArgs e)
{
// Store the index of the setting from the ListBox
int setting = ((System.Windows.Forms.ListBox)sender).SelectedIndex;
// Change the proxy setting.
player.network.setProxySettings("HTTP", setting);
}
' Load the list box with the proxy settings in order so that their index in the
' list box matches their value.
proxySettings.Items.Add("Do not use a proxy server. (Value = 0)")
proxySettings.Items.Add("Use the proxy settings of the current browser. Valid for HTTP only. (Value = 1)")
proxySettings.Items.Add("Use the manually specified proxy settings. (Value = 2)")
proxySettings.Items.Add("Auto-detect the proxy settings. (Value = 3)")
' Change the proxy setting for the HTTP protocol when the user makes a list box selection.
Public Sub proxySettings_OnSelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles proxySettings.SelectedIndexChanged
' Store the index of the setting from the ListBox
Dim lb As System.Windows.Forms.ListBox = sender
Dim setting As Integer = lb.SelectedIndex
' Change the proxy setting.
player.network.setProxySettings("HTTP", setting)
End Sub
Spécifications
| Condition requise | Valeur |
|---|---|
| Version |
Lecteur Windows Media série 9 ou version ultérieure |
| Espace de noms |
WMPLib |
| Assembly |
|