Share via


Windows Media Player 11 SDK IWMPNetwork.setProxyBypassForLocal (VB and C#) 

Windows Media Player SDK banner art

Previous Next

IWMPNetwork.setProxyBypassForLocal (VB and C#)

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

  

Parameters

bstrProtocol

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

fBypassForLocal

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

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.

Example Code

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.
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

FakePre-bb38443a8e1140a880eca7016e67725d-d0d6e999dca845319405b11db77dc30d

// 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!");
}

Requirements

Version: Windows Media Player 9 Series or later

Namespace: WMPLib

Assembly: Interop.WMPLib.dll (automatically generated by Visual Studio)

See Also

Previous Next