如何在关机或重启前及早检测计算机 [英] How To Early detection of computer before shutdown or restart

查看:106
本文介绍了如何在关机或重启前及早检测计算机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在用nsis创建一个安装程序,现在我需要将值保存到注册表在计算机关机,重启,注销之前。

I am creating an installer with nsis and now I need to save values to registry before computer shutdown,restart,log off.


我不知道如何访问(shutdown,restart,...)标志!在Windows关闭之前的时刻,重启是一个要检查的标志?

I don't know how can I access to the (shutdown,restart,...) flags! Moments before windows shutdown, restart is a flag to checked?

推荐答案

在这里:

MessageBox MB_YESNO|MB_ICONQUESTION "Do you wish to reboot the system?" IDNO +2
Reboot

如果您想在自己的时间重启,请设置  SetRebootFlag
标志:

Instead of this, If you want to reboot at it's own time, set SetRebootFlag flag:

然而,我使用Jordan Russell的InnoScript多年。为什么不尝试
InnoScript
,用
Studio
(帮助向导),也可以免费用于商业用途。您可以在一行代码中保存到注册表。安装软件后还要求用户重启电脑。学习inno脚本不会超过30分钟。此外,你不需要
学习,因为它的助手向导叫做工作室指导你以简单的向导方式做所有事情。

However, I am using Jordan Russell's InnoScript for years. Why don't you try InnoScript with it's Studio (Helper wizard), which is free for commerical use too. You can save to registry in a single line of code. also ask user to restart the pc after installing your software. Learning inno script won't take more than 30 minutes. Moreover, you need not learn since it's helper wizard called studio guides you to do everything in a easy wizard way.

添加到注册表:

Adding to Registry:

[Registry]      
Root: HKCU; Subkey: "Software\Microsoft\Windows\CurrentVersion\Run"; ValueName: "IslamBrowser2.4Reminder"; ValueType: String; ValueData: "{app}\IslamBrowser2.4Reminder.exe" ; Flags: uninsdeletevalue 

无论你需要在重启之前运行什么,都要放在Run部分下:

Whatever you need to run before Restart, place under Run section:

[Run]         
Filename: "{app}\myappbeforeRestart.exe";

有数千个文档有助于inno设置。

如果有帮助则标记为答案。

There are thousands of documentation helps for inno setup.
Mark as Answer if it helps.

谢谢。


这篇关于如何在关机或重启前及早检测计算机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆