【问题标题】:How to hide all windows until I need them in NSIS如何隐藏所有窗口,直到我在 NSIS 中需要它们
【发布时间】:2009-10-21 23:23:39
【问题描述】:

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

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

如何防止闪烁的窗口?

示例代码:

名称“闪烁测试” 输出文件“flickertest.exe” 自动关闭窗口真 部分 隐藏窗口 部分结束

【问题讨论】:

    标签: nsis


    【解决方案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
    

    【讨论】:

      【解决方案2】:

      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
      

      【讨论】:

        【解决方案3】:
        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
        

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 2011-05-25
          • 1970-01-01
          • 2015-08-10
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多