ActivationRegistrationManager.RegisterForFileTypeActivation 方法

定义

注册以在通过 ShellExecuteLauncher.LaunchFileAsync 或命令行打开指定文件类型时激活应用。

public:
 static void RegisterForFileTypeActivation(Platform::Array <Platform::String ^> ^ supportedFileTypes, Platform::String ^ logo, Platform::String ^ displayName, Platform::Array <Platform::String ^> ^ supportedVerbs, Platform::String ^ exePath);
/// [Windows.Foundation.Metadata.Experimental]
 static void RegisterForFileTypeActivation(winrt::array_view <winrt::hstring const&> const& supportedFileTypes, winrt::hstring const& logo, winrt::hstring const& displayName, winrt::array_view <winrt::hstring const&> const& supportedVerbs, winrt::hstring const& exePath);
 static void RegisterForFileTypeActivation(winrt::array_view <winrt::hstring const&> const& supportedFileTypes, winrt::hstring const& logo, winrt::hstring const& displayName, winrt::array_view <winrt::hstring const&> const& supportedVerbs, winrt::hstring const& exePath);
[Windows.Foundation.Metadata.Experimental]
public static void RegisterForFileTypeActivation(string[] supportedFileTypes, string logo, string displayName, string[] supportedVerbs, string exePath);
public static void RegisterForFileTypeActivation(string[] supportedFileTypes, string logo, string displayName, string[] supportedVerbs, string exePath);
function registerForFileTypeActivation(supportedFileTypes, logo, displayName, supportedVerbs, exePath)
Public Shared Sub RegisterForFileTypeActivation (supportedFileTypes As String(), logo As String, displayName As String, supportedVerbs As String(), exePath As String)

参数

supportedFileTypes

String[]

Platform::String[]

winrt::hstring[]

一个或多个受支持的文件类型,由文件扩展名指定,包括前导 .,例如 .docx

logo
String

Platform::String

winrt::hstring

Windows 用于文件类型的图像或资源的路径。 对于打包的应用,此参数是映像文件的包相对路径。 对于未打包,此参数是二进制文件的文本文件路径, (DLL、EXE) 加上资源索引。

displayName
String

Platform::String

winrt::hstring

Windows 用于文件类型的此显示名称。

supportedVerbs

String[]

Platform::String[]

winrt::hstring[]

零个或多个应用定义的谓词。 右键单击已注册的文件时,每个谓词都会添加到文件资源管理器上下文菜单,并且所选谓词作为 IFileActivatedEventArgs.Verb 属性传递到应用。

exePath
String

Platform::String

winrt::hstring

要激活的可执行文件的路径。 如果传递空字符串,则默认激活当前 exectuable。 通常,如果此方法的调用方是应用的安装程序而不是应用本身,则指定此参数。

属性

注解

UnregisterForFileTypeActivation

适用于