【问题标题】:Adding a checkbox to the NSIS Uninstaller Welcome Page向 NSIS 卸载程序欢迎页面添加复选框
【发布时间】:2013-10-27 18:37:56
【问题描述】:

我正在尝试在我的 NSIS 卸载程序的欢迎屏幕中添加一个复选框,但我找不到示例。在 MUI2 的 documentation 中,我找不到任何可以在欢迎页面上运行的自定义函数。

根据我找到的文档和其他answers,看起来完成页面更容易自定义。

有没有办法自定义欢迎页面?如果没有,实现意图的其他选项是什么?

【问题讨论】:

    标签: nsis uninstallation nsdialogs nsis-mui


    【解决方案1】:

    您链接到的 MUI(1) 文档有一个关于如何在预/显示回调中自定义欢迎页面的说明。使用 MUI2,您可以在显示回调中添加控件。有关这些自定义控件的更多信息,请参阅 nsDialogs 文档...

    !include MUI2.nsh
    !insertmacro MUI_PAGE_INSTFILES
    !define MUI_PAGE_CUSTOMFUNCTION_SHOW un.ModifyUnWelcome
    !define MUI_PAGE_CUSTOMFUNCTION_LEAVE un.LeaveUnWelcome
    !insertmacro MUI_UNPAGE_WELCOME
    !insertmacro MUI_UNPAGE_INSTFILES
    !insertmacro MUI_LANGUAGE English
    
    Var mycheckbox ; You could just store the HWND in $1 etc if you don't want this extra variable
    
    Function un.ModifyUnWelcome
    ${NSD_CreateCheckbox} 120u -18u 50% 12u "Do something special"
    Pop $mycheckbox
    SetCtlColors $mycheckbox "" ${MUI_BGCOLOR}
    ${NSD_Check} $mycheckbox ; Check it by default
    FunctionEnd
    
    Function un.LeaveUnWelcome
    ${NSD_GetState} $mycheckbox $0
    ${If} $0 <> 0
        MessageBox mb_ok "I'm special"
    ${EndIf}
    FunctionEnd
    
    Section testuninstaller
    Initpluginsdir
    WriteUninstaller "$pluginsdir\u.exe"
    ExecWait '"$pluginsdir\u.exe" _?=$pluginsdir'
    Sectionend
    

    【讨论】:

    • 该复选框对我来说有问题,它不会在其所有表面上都可以点击。我已更改坐标以使其正常工作:120u -20u 50% 20u
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-11-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-01-26
    相关资源
    最近更新 更多