共用方式為


AxWindowsMediaPlayer.launchURL 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 launchURL method sends a URL to the user's default browser to be rendered.

Syntax

public void launchURL(
  System.String bstrURL
);

Public Sub launchURL( _
  ByVal bstrURL As System.String _
)

Parameters

bstrURL

The System.String that is the URL to launch.

Return value

This method does not return a value.

Remarks

This method only opens webpages using the HTTP or HTTPS protocols.

Examples

The following example creates a button that, when clicked, displays the Microsoft website in a new browser window. The AxWMPLib.AxWindowsMediaPlayer object is represented by the variable named player.

private void goToMS_Click(object sender, System.EventArgs e)
{
    // Open the Microsoft website. 
    player.launchURL("https://www.microsoft.com");
}

Public Sub goToMS_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles goToMS.Click

    ' Open the Microsoft website. 
    player.launchURL("https://www.microsoft.com")

End Sub

Requirements

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

See also

AxWindowsMediaPlayer Object (VB and C#)