語言

ActivationRegistrationManager.RegisterForStartupActivation 方法

定義

當使用者登入 Windows 作業系統啟動應用程式時,會註冊啟用該應用程式,可能是因為登錄檔鍵,或是透過知名啟動資料夾中的捷徑。

public:
 static void RegisterForStartupActivation(Platform::String ^ taskId, Platform::String ^ exePath);
/// [Windows.Foundation.Metadata.Experimental]
 static void RegisterForStartupActivation(winrt::hstring const& taskId, winrt::hstring const& exePath);
 static void RegisterForStartupActivation(winrt::hstring const& taskId, winrt::hstring const& exePath);
[Windows.Foundation.Metadata.Experimental]
public static void RegisterForStartupActivation(string taskId, string exePath);
public static void RegisterForStartupActivation(string taskId, string exePath);
function registerForStartupActivation(taskId, exePath)
Public Shared Sub RegisterForStartupActivation (taskId As String, exePath As String)

參數

taskId
String

Platform::String

winrt::hstring

一個應用程式定義的 ID,之後可透過 UnregisterForStartupActivation 方法取消註冊啟動啟用。

exePath
String

Platform::String

winrt::hstring

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

屬性

備註

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

適用於

另請參閱