public static extern int RegisterApplicationRestart([MarshalAs(UnmanagedType.BStr)] string commandLineArgs, ApplicationRestartFlags flags);
/// <summary> /// 向操作系统的 Restart Manager 注册应用终止后的重启方式。 /// </summary> /// <param name="pwsCommandLine"> /// 应用程序的重启时应该使用的参数,允许为 null,表示不带参数。 /// 请注意:如果命令行参数中的某一个参数包含空格,请加上引号。 /// </param> /// <param name="dwFlags">为应用程序的重启行为添加限制,默认没有限制。</param> /// <returns></returns> public static bool RegisterApplicationRestart( [CanBeNull] string pwsCommandLine, ApplicationRestartFlags dwFlags = ApplicationRestartFlags.None) { return(0 == RegisterApplicationRestart(pwsCommandLine, (int)dwFlags)); }
public static extern int GetApplicationRestartSettings(IntPtr hProcess, StringBuilder pwzCommandline, ref uint pcchSize, out ApplicationRestartFlags pdwFlags);