更改默认按钮名称NSIS

时间:2013-08-21 22:16:06

标签: nsis

我对NSIS很新, 我用2个屏幕创建了一个简单的安装程序,

!include LogicLib.nsh
!include nsDialogs.nsh

Page custom someName someEndmethod
Page instfiles

第一个是自定义页面(nsDialogs),默认按钮是“install”,我有2个任务:

  • 如何将方法绑定到其click事件?
  • 如何更改该按钮上的文字?

BTW - 我没有使用MUI。

我可以找到关于nsDialogs的最佳参考如下: http://nsis.sourceforge.net/Docs/nsDialogs/Readme.html

但似乎无法找到这些简单问题的答案。

由于

1 个答案:

答案 0 :(得分:1)

!include WinMessages.nsh
Function MyPageCreate
GetDlgItem $0 $hwndparent 1 ; Get the handle to the button
SendMessage $0 ${WM_SETTEXT} 0 `STR:$(^NextBtn)` ; The part after STR: can be any string, using the next button language string here
nsDialogs::Create 1018
pop $0
nsDialogs::Show
FunctionEnd

Function MyPageLeave
MessageBox mb_yesno "User clicked Next/Install, allow the page change?" IDYES allow
    Abort
allow:
FunctionEnd

Page Components
Page Custom MyPageCreate MyPageLeave
Page InstFiles

如果您只想更改安装按钮上的字符串,无论它在哪个页面(instfiles页面之前的页面),您都可以使用LangString更改它。