Launcher.LaunchUriAsync Method (Windows.System)
发布时间:2026-09-21 | 浏览:1
访问此页面需要授权。 可以尝试 登录 或 更改目录 。
访问此页面需要授权。 可以尝试 更改目录 。
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Starts the default app associated with the URI scheme name for the specified URI, using the specified options and input data.
Starts the default app associated with the URI scheme name or the one specified by the ContentType for the specified URI, using the specified options.
Starts the default app associated with the URI scheme name for the specified URI.
LaunchUriAsync(Uri, LauncherOptions, ValueSet)
Starts the default app associated with the URI scheme name for the specified URI, using the specified options and input data.
The launch options for the app.
The TargetApplicationPackageFamilyName property of the options parameter, while sometimes optional, is required for this overload of the LaunchUriAsync method.
The input data for the app.
The amount of data that can be transferred must not exceed 100 KB.
IAsyncOperation < Boolean >
IAsyncOperation <bool>
Returns true if the default app for the URI scheme was launched; false otherwise.
Unless you are calling this API from a Windows desktop application, this API must be called from within an ASTA thread (also known as the UI thread).
This API may also be called from a Windows desktop application.
This API launches the default app for the scheme whether it be a Universal Windows Platform (UWP) app or Windows desktop application.
LaunchUriAsync(Uri)
LaunchUriAsync(Uri, LauncherOptions)
LaunchUriAsync(Uri, LauncherOptions)
Starts the default app associated with the URI scheme name or the one specified by the ContentType for the specified URI, using the specified options.
The launch options for the app.
IAsyncOperation < Boolean >
IAsyncOperation <bool>
Returns true if the default app for the URI scheme was launched; false otherwise.
This sample uses [LaunchUriAsync(Uri, LauncherOptions) to launch a URI with a warning. The TreatAsUntrusted property indicates that the system should display a warning.
Unless you are calling this API from a Windows desktop application, this API must be called from within an ASTA thread (also known as the UI thread).
This API may also be called from a Windows desktop application.
This API launches the default app for the scheme whether it be a Universal Windows Platform (UWP) app or Windows desktop application.
The calling app must be visible to the user when this API is invoked.
Unless you are calling this API from a Windows desktop application, this API must be called from within an ASTA thread (also known as a UI thread).
You must specify the privateNetworkClientServer capability in the manifest in order to launch intranet URIs, for example a file:/// URI pointing to a network location.
You cannot use this method to launch a URI in the local zone. For example, apps cannot use the file:/// protocol to access files on the local computer. Instead, you must use the Storage APIs to access files.
The content type is used to compute a file extension, from the extension the default app is chosen. For example a content type value of ""application/vnd.ms-word.document.12"" is mapped to ".docx" and then the default application for ".docx" is launched. For example:
When the launch fails for any of the above reasons, the API will succeed and return FALSE from its asynchronous operation.
To enable the user to choose an app instead of launching the default app, set the LauncherOptions.DisplayApplicationPicker property.
To display a warning that the URI is potentially unsafe, set the LauncherOptions.TreatAsUntrusted property.
The URI is passed to the associated app. If the associated app is a desktop app, the URI is passed using shell execution mechanisms.
LaunchUriAsync(Uri)
LaunchUriAsync(Uri, LauncherOptions, ValueSet)
Association launching sample
Guidelines for file types and URIs
Launch the default app for a URI
LaunchUriAsync(Uri)
Starts the default app associated with the URI scheme name for the specified URI.
IAsyncOperation < Boolean >
IAsyncOperation <bool>
Returns true if the default app for the URI scheme was launched; false otherwise.
This example uses LaunchUriAsync(Uri) to launch a URI.
Unless you are calling this API from a Windows desktop application, this API must be called from within an ASTA thread (also known as the UI thread).
This API may also be called from a Windows desktop application.
This API launches the default app for the scheme whether it be a Universal Windows Platform (UWP) app or Windows desktop application.
The calling app must be visible to the user when the API is invoked.
You must specify the privateNetworkClientServer capability in the manifest in order to launch intranet URIs, for example a file:/// URI pointing to a network location.
You cannot use this method to launch a URI in the local zone. For example, apps cannot use the file:/// protocol to access files on the local computer. Instead, you must use the Storage APIs to access files.
When the launch fails for any of the above reasons, the API will succeed and return FALSE from its asynchronous operation.
To enable the user to choose an app instead of launching the default app, set the LauncherOptions.DisplayApplicationPicker property.
To display a warning that the URI is potentially unsafe, set the LauncherOptions.TreatAsUntrusted property.
The URI is passed to the associated app. If the associated app is a desktop app, the URI is passed using shell execution mechanisms.
LaunchUriAsync(Uri, LauncherOptions)
LaunchUriAsync(Uri, LauncherOptions, ValueSet)
Association launching sample
Guidelines for file types and URIs
Launch the default app for a URI
想要尝试使用 Ask Learn 阐明或指导你完成本主题?