2009-10-21 44 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