2009-10-21 41 views
1

我有一个NSIS安装程序,我想完全沉默,除非它需要下载其他文件。我可以使用SilentInstall完全保持沉默,但随后我无法让我的下载对话框出现(我正在使用InetLoad :: load)。如何隐藏所有的窗口,直到我需要他们在NSIS

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

如何防止闪烁窗口?

示例代码:

 
Name "Flicker test" 
OutFile "flickertest.exe" 

AutoCloseWindow true 

Section 
    HideWindow 
SectionEnd 

回答

1

这是做这件事的黑客攻击方式:

!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 
1

You can use skipping pages举例MUI2(隐藏目录页面,如果模式更新):

!define MUI_PAGE_CUSTOMFUNCTION_PRE dirPre 
!insertmacro MUI_PAGE_DIRECTORY 

Function dirPre 
    StrCmp $Mode "update" +1 +2 
    abort 
FunctionEnd 
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