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

Windows Media Player SDK banner art

Previous Next

IWMPNetwork.setProxyName (VB and C#)

The setProxyName method specifies the name of the proxy server to use.

  

Parameters

bstrProtocol

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

bstrProxyName

A System.String that is the name of the proxy server to use.

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 setProxyName to specify the name of the Windows Media Player proxy server for the MMS protocol. The new name is retrieved from a text box when a button is clicked. The AxWMPLib.AxWindowsMediaPlayer object is represented by the variable named player.

  
Public Sub setProxyName_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles setProxyName.Click

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

        ' Store the user's new proxy name.
        Dim proxyname As String = nameText.Text

        ' Set the proxy name.
        player.network.setProxyName("MMS", proxyname)

    Else

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

    End If

End Sub

FakePre-91fce351660d4c7289e89080ef43728b-704a8f1a87e14eb49f753437a0f9cbad

private void setProxyName_Click(object sender, System.EventArgs e)
{
    // Test whether proxy settings are manual.
    if (player.network.getProxySettings("MMS") == 2)
    {
        // Store the user's new proxy name.
        string proxyname = nameText.Text;

        // Set the proxy name.
        player.network.setProxyName("MMS", proxyname);
    }
    else
    {
        // Warn that the 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