简体   繁体   English

NSIS 问题:当“.onInstSuccess” function 未完成时,我可以禁用“MUI_PAGE_FINISH”页面中的“完成”按钮吗?

[英]NSIS question : Can I disable the “Finish” button in “MUI_PAGE_FINISH” page when the “.onInstSuccess” function not finish?

I use NSIS to package my application, and I need to install some third party software, like.Net re-distribution, run-time engine in ".onInstSuccess" function.我使用 NSIS 来 package 我的应用程序,我需要安装一些第三方软件,如 .Net 重新分发,运行时引擎在“.onInstSuccess” function 中。 But after install finish, the "MUI_PAGE_FINISH" page will display and start to call ".onInstSuccess" function.但安装完成后,会显示“MUI_PAGE_FINISH”页面并开始调用“.onInstSuccess”function。 If user click the finish button in "MUI_PAGE_FINISH" page when ".onInstSuccess" function still running, that will be not fully install third party software.如果用户在“.onInstSuccess” function 仍在运行时单击“MUI_PAGE_FINISH”页面中的完成按钮,则不会完全安装第三方软件。 Can I disable the finish button and re-enable it after ".onInstSuccess" function finished?我可以禁用完成按钮并在“.onInstSuccess”function 完成后重新启用它吗? enter image description here在此处输入图像描述

You should only install things in Section s, When the InstFiles page is done.当 InstFiles 页面完成时,您应该只在Section s 中安装东西。 your install should be fully functional.您的安装应该功能齐全。 Make sure you are using ExecWait and the correct command line parameters (silent/wait etc.) when installing redistributable libraries.确保在安装可再发行库时使用ExecWait和正确的命令行参数(静默/等待等)。

.onInstSuccess is called after the last page and you are not really supposed to interact with the UI nor perform operations that take a long time. .onInstSuccess在最后一页之后调用,您实际上不应该与 UI 交互,也不应该执行需要很长时间的操作。

!include MUI2.nsh
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_LANGUAGE English

Function .onInstSuccess
GetDlgItem $0 $hWndParent 1
EnableWindow $0 0
Messagebox mb_ok "Performing a long operation here even though you are not supposed to..."
EnableWindow $0 1
FunctionEnd

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM