3

我有一个 NSIS 安装程序,除非它需要下载其他文件,否则我希望完全保持沉默。我可以使用 SilentInstall 让它完全静音,但是我不能让我的下载对话框出现(我正在使用 InetLoad::load)。

我想告诉 NSIS 在我这样说之前不要显示任何窗口。我能想到的最好的方法是 HideWindow。Unfortantly 看起来 NSIS 默认显示窗口然后隐藏它导致闪烁。

如何防止闪烁的窗口?

示例代码:

名称“闪烁测试”
输出文件“flickertest.exe”

自动关闭窗口真

部分
    隐藏窗口
部分结束
4

3 回答 3

3

这是一种黑客方式:

!include "${NSISDIR}\Examples\System\System.nsh"

Name "No Flicker test"
OutFile "noflickertest.exe"

AutoCloseWindow true

Function .onGUIInit
    ; move window off screen
    System::Call "User32::SetWindowPos(i, i, i, i, i, i, i) b ($HWNDPARENT, 0, -10000, -10000, 0, 0, ${SWP_NOOWNERZORDER}|${SWP_NOSIZE})"
FunctionEnd

Section -main
    HideWindow
SectionEnd
于 2009-11-09T01:44:08.523 回答
2

您可以使用MUI2 的跳过页面示例(如果模式为更新,则隐藏目录页面):

!define MUI_PAGE_CUSTOMFUNCTION_PRE dirPre
!insertmacro MUI_PAGE_DIRECTORY

Function dirPre
    StrCmp $Mode "update" +1 +2
    abort
FunctionEnd
于 2011-10-27T13:20:58.840 回答
0
OutFile "example.exe"

SilentInstall silent

RequestExecutionLevel user<br>
ReserveFile test.exe

Section ""<br>
&emsp;InitPluginsDir<br>
&emsp;File /oname=$PLUGINSDIR\test.exe test.exe<br>
&emsp;ExecWait "$PLUGINSDIR\test.exe"<br>
SectionEnd
于 2016-05-28T16:17:25.443 回答