| 术语 | registerapplicationrestart |
| 释义 | RegisterApplicationRestart 语法: C++ HRESULT WINAPI RegisterApplicationRestart( __in_opt PCWSTR pwzCommandline, __in DWORD dwFlags ); RegisterApplicationRestart功能 登记册上的一个积极的实例重新启动应用程序。 参数 pwzCommandline [中,可选] 一个Unicode字符串,用于指定当重新启动应用程序的命令行参数的指针。该命令行,您可以指定的最大大小为RESTART_MAX_CMD_LINE字符。不包括在命令行中可执行文件的名称,这个功能为您添加。 如果此参数为NULL或空字符串,以前注册的命令行被删除。如果参数包含空格,参数使用引号。 dwFlags [in] 此参数可以是0或一个或多个下列值。 ValueMeaning RESTART_NO_CRASH 1Do不重新启动该进程如果终止是由于未处理的异常。 RESTART_NO_HANG 2Do不重新启动该进程如果终止是由于应用程序没有响应。 RESTART_NO_PATCH 4Do不重新启动该进程如果终止由于安装更新。 RESTART_NO_REBOOT 8点,如果不重新启动计算机是作为一个更新的结果重新启动的过程。 返回值 这个函数返回S_OK在成功或下面的错误代码之一。 返回codeDescription E_FAILInternal错误。 E_INVALIDARGThe指定的命令行太长。 备注 您的初始登记之前,必须进行重新启动的应用程序遇到未处理的异常或变得没有反应。然后,您可以在您的调用这个函数回调恢复更新的命令行。 对于Windows应用程序正在更新,最后机会调用此函数是在处理WM_QUERYENDSESSION消息。对于一个控制台应用程序正在更新,必须在登记前,安装程序会尝试关闭应用程序(您需要保持目前的注册,您不能调用此函数在处理CTRL_C_EVENT通知)。 如果您重新启动并申请注册遇到未处理的异常或没有响应,用户提供的机会,重新启动应用程序,该应用程序不会自动未经用户同意的重新启动。但是,如果应用程序正在更新,需要重新启动,应用程序自动重新启动。 为了防止周期性重新启动后,系统将只重新启动应用程序是否已为60秒的最低运行。 请注意,申请重新启动时,更新需要重新启动计算机时,安装程序必须调用与EWX_RESTARTAPPS标志设置,或与SHUTDOWN_RESTARTAPPS旗InitiateShutdown函数ExitWindowsEx函数集。 要求: client最低支持Vista server最低支持 Windows Server 2008 HeaderWinbase.h(头文件:winuser.h) LibraryKernel32.lib DLLKernel32.dll 参见 UnregisterApplicationRestart 如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com) 生成日期:2009年7月30日 ==英文原文==RegisterApplicationRestart Function Registers the active instance of an application for restart. Syntax C++ HRESULT WINAPI RegisterApplicationRestart( __in_opt PCWSTR pwzCommandline, __in DWORD dwFlags ); Parameters pwzCommandline [in, optional] A pointer to a Unicode string that specifies the command-line arguments for the application when it is restarted. The maximum size of the command line that you can specify is RESTART_MAX_CMD_LINE characters. Do not include the name of the executable in the command line; this function adds it for you. If this parameter is NULL or an empty string, the previously registered command line is removed. If the argument contains spaces, use quotes around the argument. dwFlags [in] This parameter can be 0 or one or more of the following values. ValueMeaning RESTART_NO_CRASH 1Do not restart the process if it terminates due to an unhandled exception. RESTART_NO_HANG 2Do not restart the process if it terminates due to the application not responding. RESTART_NO_PATCH 4Do not restart the process if it terminates due to the installation of an update. RESTART_NO_REBOOT 8Do not restart the process if the computer is restarted as the result of an update. Return Value This function returns S_OK on success or one of the following error codes. Return codeDescription E_FAILInternal error. E_INVALIDARGThe specified command line is too long. Remarks Your initial registration for restart must occur before the application encounters an unhandled exception or becomes unresponsive. You could then call this function from inside your recovery callback to update the command line. For a Windows application that is being updated, the last opportunity to call this function is while processing the WM_QUERYENDSESSION message. For a console application that is being updated, the registration must occur before the installer tries to shutdown the application (you need to keep the registration current; you cannot call this function when handling the CTRL_C_EVENT notification). If you register for restart and the application encounters an unhandled exception or is not responsive, the user is offered the opportunity to restart the application; the application is not automatically restarted without the user's consent. However, if the application is being updated and requires a restart, the application is restarted automatically. To prevent cyclical restarts, the system will only restart the application if it has been running for a minimum of 60 seconds. Note that for an application to be restarted when the update requires a computer restart, the installer must call the ExitWindowsEx function with the EWX_RESTARTAPPS flag set or the InitiateShutdown function with the SHUTDOWN_RESTARTAPPS flag set. Requirements Minimum supported clientWindows Vista Minimum supported serverWindows Server 2008 HeaderWinbase.h (include Windows.h) LibraryKernel32.lib DLLKernel32.dll See Also UnregisterApplicationRestart Send comments about this topic to Microsoft Build date: 7/30/2009 ==原始网址==http://msdn.microsoft.com/en-us/library/aa373347(VS.85).aspx\n |
| 随便看 |
|
windows api函数参考手册包含2258条windows api函数文档,详细介绍nodejs、java、rust调用windows api的方法技巧,是学习windows api编程的入门中文文档。