简体   繁体   English

如何从NSIS的Function中使用的Label调用Section?

[英]How to call Section from Label used in Function in NSIS?

I am comparing the version check in the Function called by .onInit, If this version check tells machine has older version then i would like uninstall the older version. 我正在比较.onInit调用的函数中的版本检查,如果此版本检查告诉计算机具有较旧的版本,那么我想卸载较旧的版本。 How to achieve this?? 如何实现这一目标? my method is if older version is present then messagebox displays u have older version installed click ok to install new version or cancel to continue with the old version. 我的方法是,如果存在较旧的版本,则消息框将显示您已安装了较旧的版本,单击“确定”以安装新版本,或取消以继续使用旧版本。 IDOK ok IDCANCEL cancel ok: ExecWait Uninstal ; IDOK ok IDCANCEL取消ok:ExecWait Uninstal; executes uninstall.exe cancel: Abort ; 执行uninstall.exe取消:中止; continue wid olde version. 继续旧版本。

problem here is ExecWait is getting executed parallely wid newer version installation. 这里的问题是ExecWait正在并行执行较新版本的安装。 (both r becuming 2 diff threads) (都由2个diff线程组成)

for this i wanted to include only Section Uninstall inside the label of the function to uninstall silently. 为此,我只想在功能标签内包括“部分卸载”以静默卸载。

Please guide me how to call Section from the Function. 请指导我如何从函数中调用Section。

Thanks in Advance 提前致谢

You cannot call a section but you can do this: 您不能调用一个部分,但是您可以这样做:

Function MySectionCode
# My code goes here
FunctionEnd

Function .onInit
call MySectionCode
FunctionEnd

Section "MySection"
call MySectionCode
SectionEnd

And just to be clear, ExecWait always waits for the child process but sometimes the child process starts its children and does not wait for them. 需要明确的是,ExecWait 始终等待子进程,但有时子进程启动其子进程,而不等待它们。 To wait for a NSIS uninstaller you need to use the special _?= parameter . 要等待NSIS卸载程序,您需要使用特殊的_?=参数

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

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