Metodo IWMPNetwork::setProxySettings

[La funzionalità associata a questa pagina, Lettore multimediale Windows SDK, è una funzionalità legacy. È stata sostituita da MediaPlayer. MediaPlayer è stato ottimizzato per Windows 10 e Windows 11. Microsoft consiglia vivamente che il nuovo codice usi MediaPlayer anziché 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 setProxySettings specifica le impostazioni proxy per un protocollo.

Sintassi

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

Parametri

bstrProtocol [in]

Oggetto System.String che corrisponde al nome del protocollo. Per un elenco di protocolli supportati, vedere Protocolli e tipi di file supportati.

lProxySetting [in]

System.Int32 che è uno dei valori seguenti.

Valore Descrizione
0 Non usare un server proxy.
1 Usare le impostazioni proxy del browser corrente (valido solo per HTTP).
2 Usare le impostazioni proxy specificate manualmente.
3 Rilevare automaticamente le impostazioni del proxy.

Valore restituito

Questo metodo non restituisce valori.

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 usata una casella di riepilogo per consentire all'utente di impostare l'impostazione proxy di Lettore multimediale Windows per il protocollo HTTP. L'oggetto AxWMPLib.AxWindowsMediaPlayer è rappresentato dalla variabile denominata 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

Requisiti

Requisito Valore
Versione
Lettore multimediale Windows serie 9 o versioni 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#)