IWMPNetwork::setProxyBypassForLocal method

[The feature associated with this page, Windows Media Player SDK, is a legacy feature. It has been superseded by MediaPlayer. MediaPlayer has been optimized for Windows 10 and Windows 11. Microsoft strongly recommends that new code use MediaPlayer instead of Windows Media Player SDK, when possible. Microsoft suggests that existing code that uses the legacy APIs be rewritten to use the new APIs if possible.]

The setProxyBypassForLocal method specifies whether the proxy server is bypassed if the origin server is on a local network.

Syntax

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

Parameters

bstrProtocol [in]

A System.String that is the protocol name. For a list of supported protocols, see Supported Protocols and File Types.

fBypassForLocal [in]

A System.Boolean value that indicates whether the proxy server is bypassed.

Return value

This method does not return a value.

Remarks

This method has no effect unless the value retrieved from IWMPNetwork.getProxySettings is 2 (use manual settings).

This method fails unless the calling application is running on the local computer or intranet.

Examples

The following code example uses setProxyBypassForLocal to specify whether the Windows Media Player proxy server is bypassed, when using the MMS protocol, if the origin server is on a local network. The AxWMPLib.AxWindowsMediaPlayer object is represented by the variable named 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

Requirements

Requirement Value
Version
Windows Media Player 9 Series or later
Namespace
WMPLib
Assembly
Interop.WMPLib.dll (Interop.WMPLib.dll.dll)

See also

IWMPNetwork Interface (VB and C#)

IWMPNetwork.getProxyBypassForLocal (VB and C#)

IWMPNetwork.getProxySettings (VB and C#)