Metodo IWMPNetwork::setProxyBypassForLocal

[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 setProxyBypassForLocal specifica se il server proxy viene ignorato se il server di origine si trova in una rete locale.

Sintassi

public void setProxyBypassForLocal(
  System.String bstrProtocol,
  System.Boolean fBypassForLocal
);

Public Sub setProxyBypassForLocal( _
  ByVal bstrProtocol As System.String, _
  ByVal fBypassForLocal As System.Boolean _
)
Implements IWMPNetwork.setProxyBypassForLocal

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.

fBypassForLocal [in]

Valore System.Boolean che indica se il server proxy viene ignorato.

Valore restituito

Questo metodo non restituisce valori.

Commenti

Questo metodo non ha alcun effetto a meno che il valore recuperato da IWMPNetwork.getProxySettings sia 2 (usare le impostazioni manuali).

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 setProxyBypassForLocal per specificare se il server proxy di Lettore multimediale Windows viene ignorato, quando si usa il protocollo MMS, se il server di origine si trova in una rete locale. L'oggetto AxWMPLib.AxWindowsMediaPlayer è rappresentato dalla variabile denominata player.

// Prepare a message, a caption and buttons for the user prompt.
string message = ("Bypass proxy server for local addresses?");
string caption = "Proxy Settings";
System.Windows.Forms.MessageBoxButtons buttons = System.Windows.Forms.MessageBoxButtons.YesNo;

// Test whether the proxy settings are manual.
if (player.network.getProxySettings("MMS") == 2)
{
    // Prompt the user for a setting. 
    System.Windows.Forms.DialogResult result = System.Windows.Forms.MessageBox.Show(message, caption, buttons);

    // Store the return value of the DialogResult in a boolean variable.
    bool proxybypass;
    
    if(result == System.Windows.Forms.DialogResult.Yes)
    {
        proxybypass = true;
    }
    else
    {
        proxybypass = false;
    }

    // Set the proxy bypass value according to the response.
    player.network.setProxyBypassForLocal("MMS", proxybypass);
}
else
{
    // Warn that proxy settings must be set to 2 (manual).
    System.Windows.Forms.MessageBox.Show("Proxy settings must be manual!");
}

' Prepare a message, a caption and buttons for the user prompt.
Dim message As String = "Bypass proxy server for local addresses?"
Dim caption As String = "Proxy Settings"
Dim buttons As System.Windows.Forms.MessageBoxButtons = System.Windows.Forms.MessageBoxButtons.YesNo

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

    ' Prompt the user for a setting. 
    Dim result As System.Windows.Forms.DialogResult = System.Windows.Forms.MessageBox.Show(message, caption, buttons)

    ' Store the return value of the DialogResult as a boolean.
    Dim proxybypass As Boolean

    If (result = System.Windows.Forms.DialogResult.Yes) Then

        proxybypass = True

    Else

        proxybypass = False

    End If

    ' Set the proxy bypass value according to the response.
    player.network.setProxyBypassForLocal("MMS", proxybypass)

Else

    ' Warn that proxy settings must be set to 2 (manual).
    System.Windows.Forms.MessageBox.Show("Proxy settings must be manual!")

End If

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.getProxyBypassForLocal (VB e C#)

IWMPNetwork.getProxySettings (VB e C#)