/// <summary> /// Launches an application using activation and the specified arguments /// <param name="arguments">Arguments to pass to the app</param> /// <returns>Process ID of launched app</returns> /// </summary> public UInt32 Launch(String arguments) { UInt32 pid = 0; aam.ActivateApplication(AppUserModelId, arguments, ACTIVATEOPTIONS.AO_NONE, out pid); return(pid); }
/// <summary> /// Activate an application from its Application Model ID. /// </summary> /// <param name="app_model_id">The app model ID.</param> /// <param name="arguments">Arguments for the activation.</param> /// <param name="throw_on_error">True to throw on error.</param> /// <returns>The PID of the process.</returns> public static NtResult <int> ActivateApplication(string app_model_id, string arguments, bool throw_on_error) { IApplicationActivationManager mgr = (IApplicationActivationManager) new ApplicationActivationManager(); return(mgr.ActivateApplication(app_model_id, arguments, ACTIVATEOPTIONS.AO_NONE, out int pid).CreateResult(throw_on_error, () => pid)); }
private void Office_OnClick(object sender, RoutedEventArgs e) { _applicationActivationManager.ActivateApplication( "Microsoft.MicrosoftOfficeHub_8wekyb3d8bbwe!Microsoft.MicrosoftOfficeHub", null, ActivateOptions.None, out var pid); }