NSIS - 如何覆盖“un.onInit”打回来

发布于 2025-01-15 01:28:52 字数 394 浏览 2 评论 0原文

我是 NSIS 脚本编写的新手,我想在弹出默认卸载窗口之前添加提示消息。如果他们单击“继续”,卸载将继续并显示默认卸载窗口,但如果他们单击“取消”,卸载将停止并且不会删除任何应用程序文件。

谢谢。

我尝试了这个脚本:

Function un.onInit

  MessageBox MB_YESNO "This will uninstall. Continue?"

FunctionEnd

但运行电子生成器时出现错误:

Error: Function named "un.onInit" already exists.
!include: error in script: "uninstaller.nsh" on line 5

I am new in NSIS scripting, and I want to add a prompt message before the default uninstall window pop up. And if they click Proceed, uninstalling will continue by showing the default uninstall window, but if they click Cancel, uninstalling will stop and won't delete any application files.

Thank you.

I tried this script:

Function un.onInit

  MessageBox MB_YESNO "This will uninstall. Continue?"

FunctionEnd

But I'm getting an error when running electron-builder:

Error: Function named "un.onInit" already exists.
!include: error in script: "uninstaller.nsh" on line 5

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

昇り龍 2025-01-22 01:28:52

Electron 已经将回调用于其自身目的,但它确实提供了您可以使用的宏选项。请参阅其文档中的自定义脚本部分。

在自定义 .nsh 中,只需添加宏:

!macro customUnInit
MessageBox MB_YESNO|MB_ICONQUESTION "Are you sure you want to uninstall $(^Name)?" IDYES +2
  Quit
!macroend

Electron is already using that callback for its own purpose but it does provide the option of a macro you can use. See the custom script section in their documentation.

In the custom .nsh, simply add the macro:

!macro customUnInit
MessageBox MB_YESNO|MB_ICONQUESTION "Are you sure you want to uninstall $(^Name)?" IDYES +2
  Quit
!macroend
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文