語言

ActivationRegistrationManager.RegisterForFileTypeActivation 方法

定義

當透過 ShellExecute、 Launcher.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

要啟用的執行檔路徑。 如果你傳遞空字串,目前的執行檔會預設被啟用。 通常,若呼叫此方法的使用者是應用程式的安裝程式而非應用程式本身,則會指定此參數。

屬性

備註

已封裝的應用程式應該繼續使用其 appx 指令清單來註冊檔類型、通訊協定或啟動啟用。 他們可以選擇使用 Microsoft.Windows。AppLifecycle.AppInstance.GetActivatedEventArgs 或 Windows.ApplicationModel.AppInstance.GetActivatedEventArgs 用來取得啟用時的參數。

適用於

另請參閱