在安装.CAB WM时重新启动

编程入门 行业动态 更新时间:2024-10-25 10:24:25
本文介绍了在安装.CAB WM时重新启动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

在Windows Mobile 6或CE 5设备上,我需要安装CAB文件,然后重新启动。

On a Windows Mobile 6 or CE 5 device, I need to install a CAB file and then initiate a reboot.

我知道自定义操作。您需要在本机C ++中为CAB文件创建一个setup.dll。

I am aware of custom actions. You need to create a setup.dll for the CAB file in native C++.

所以我有以下代码

codeINSTALL_EXIT Install_Exit(HWND hwndParent, LPCTSTR pszInstallDir, WORD cFailedDirs, WORD cFailedFiles, WORD cFailedRegKeys, WORD cFailedRegVals, WORD cFailedShortcuts) { MessageBox(hwndParent, _T("A reboot is required to complete installation, Press OK to reboot."), _T("Reboot required"), MB_OK); SetSystemPowerState(NULL, POWER_STATE_RESET, 0); return codeINSTALL_EXIT_DONE; }

SetSystemPowerState将在设备上执行热启动。问题是,由于安装没有完成(返回代码 INSTALL_EXIT_DONE 未达到),它抱怨说,它是无法安装应用程序,当您尝试删除它以后的时间。删除重新启动是即时解决这个问题。

SetSystemPowerState will do a warm boot on the device. The problem is that since the installation does not finish (return code INSTALL_EXIT_DONE is not reached), it complains that is it unable to install the application when you attempt to remove it at a later time. Removal of the reboot is an instant cure to this problem.

我在其他.CAB安装看到一个礼貌的消息出现重新启动是需要完成安装...,没有确定/取消按钮。然后,设备在显示消息两秒后重新启动。此外,这个软件可以卸载没有问题。

I have seen on other .CAB installs a polite message appear saying "A restart is required to complete installation..." with no OK/Cancel button. Then the device reboots after two seconds of displaying the message. Furthermore this software can be uninstalled without a problem.

我正在寻找实现相同的功能看到在其他CAB文件像上面,超时系统弹出,其次是重新启动和从设备上的删除程序选项卸载应用程序。

I am looking to achieve the same functionality seen in other CAB files like the above, a timeout system popup, followed by a reboot and the ability to uninstall the application from the remove programs option on the device.

我昨天找到的另一个可能的解决方案是以返回CONFIG_S_REBOOTREQUIRED。但是,这没有定义,因此不会编译。 codeINSTALL_EXIT的定义返回如下。

Another possible solution I found yesterday was to return CONFIG_S_REBOOTREQUIRED instead. However, this is not defined and as such will not compile. The defined returns for codeINSTALL_EXIT are as below.

Using typedef enum { codeINSTALL_EXIT_DONE = 0, // @comm Exit the installation successfully codeINSTALL_EXIT_UNINSTALL // @comm Uninstall the application before exiting the installation } codeINSTALL_EXIT;

推荐答案

从这个线程我明白,需要通知安装过程重启是

From this thread I understand that one needs to inform the installing process that a reboot is required after installing the CAB package.

因此,代替 codeINSTALL_EXIT_DONE 只需返回 CONFIG_S_REBOOTREQUIRED (不含SetSystemPowerState)。

So instead of codeINSTALL_EXIT_DONE just return CONFIG_S_REBOOTREQUIRED (without SetSystemPowerState).

我通常使用 ExitWindowsEx ,而不是 SetSystemPowerState 。 ExitWindowsEx(EWX_REBOOT | EWX_DEFER,0); 应该异步重新启动,让安装过程完成。

I usually restart windows with ExitWindowsEx instead of SetSystemPowerState.ExitWindowsEx(EWX_REBOOT | EWX_DEFER, 0); should restart asynchronously, giving time to the setup process to finish.

更多推荐

在安装.CAB WM时重新启动

本文发布于:2023-10-28 17:54:57,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1537359.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:重新启动   CAB   WM

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!