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

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

如何防止闪烁的窗口?

示例代码:

Name "Flicker test"
OutFile "flickertest.exe"

AutoCloseWindow true

Section
    HideWindow
SectionEnd
有帮助吗?

解决方案

这是一种破解方式:

!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

其他提示

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

!define MUI_PAGE_CUSTOMFUNCTION_PRE dirPre
!insertmacro MUI_PAGE_DIRECTORY

Function dirPre
    StrCmp $Mode "update" +1 +2
    abort
FunctionEnd
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
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top