将复选框添加到NSIS卸载程序欢迎页面 [英] Adding a checkbox to the NSIS Uninstaller Welcome Page

查看:442
本文介绍了将复选框添加到NSIS卸载程序欢迎页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在NSIS卸载程序的欢迎屏幕上添加一个复选框,但是在查找示例时遇到了麻烦.在MUI2的文档中,我找不到任何自定义函数可以在欢迎页面上运行.

I'm trying to add a checkbox to the welcome screen of my NSIS uninstaller, but I'm having trouble finding an example. From the documentation for MUI2 I can't find any custom functions that can be run on the welcome page.

根据文档和其他是否可以自定义欢迎页面?如果没有,实现目标的其他选择还有哪些?

Is there a way to customize the Welcome Page? If not, what are the other options for accomplishing the intent?

推荐答案

您链接到的MUI(1)文档中有关于如何在pre/show回调中自定义欢迎页面的注释.使用MUI2,您可以在show回调中添加控件.有关这些自定义控件的更多信息,请参见nsDialogs文档.

The MUI(1) documentation you linked to has a note about how you can customize the welcome page in the pre/show callbacks. With MUI2 you can add controls in the show callback. See the nsDialogs documentation for more information about these custom controls...

!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

这篇关于将复选框添加到NSIS卸载程序欢迎页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆