开发者

How to hide all windows until I need them in NSIS

I have a NSIS installer I want to be totally silent unless it needs to download additional files. I can make it totally silent with SilentInstall, but then i can't make my download dialog appear (i'm using InetLoad::load).

I would like to tell NSIS not to show any windows until I say so. The best I can come up with is HideWindow. Unfortantly it looks like NSIS开发者_运维技巧 defaults to showing the window and then hiding it causing a flicker.

How can I prevent a flickering window?

Example code:

Name "Flicker test"
OutFile "flickertest.exe"

AutoCloseWindow true

Section
    HideWindow
SectionEnd


This is a hack way of doing it:

!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


You can use skipping pages Example for MUI2 (hide directory page if mode is update):

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜