NSIS - 将CreateText添加到MUI FINISH PAGE

时间:2013-04-16 23:27:19

标签: nsis

我有一个NSIS安装程序,在安装完成后会发送一封附有几个不同日志的电子邮件。我想允许用户添加他们的电子邮件地址来接收电子邮件,我希望他们在完成页面上输入它,因为它看起来最合适。如何在完成页面上添加一个文本框,供用户输入他们的电子邮件地址?

这是我目前的完成页面:

  ;Finish page
!Define MUI_FINISHPAGE_RUN
  !Define MUI_FINISHPAGE_RUN_TEXT 'Open Install Log'
  !Define MUI_FINISHPAGE_RUN_NOTCHECKED
  !define MUI_FINISHPAGE_RUN_FUNCTION 'LaunchLog'
!define MUI_FINISHPAGE_LINK 'Click here to visit us at co.com.'
  !define MUI_FINISHPAGE_LINK_LOCATION http://www.co.com/
!define MUI_FINISHPAGE_TEXT_LARGE
!define MUI_FINISHPAGE_TEXT "text text text"
!insertmacro MUI_PAGE_FINISH

1 个答案:

答案 0 :(得分:1)

!include MUI2.nsh ;If you are using MUI v1 you need to replace NSD_* with .ini file commands
!include Logiclib.nsh
...

!ifndef EM_SETCUEBANNER
!define EM_SETCUEBANNER 0x1501 ; NT5 w/Themes & Vista+
!endif

Var EMailEdit

Function CustomizeFinishPage
${NSD_CreateText} 120u 144u 180u 12u ""
Pop $EMailEdit
System::Call 'USER32::SendMessage(i$EMailEdit,i${EM_SETCUEBANNER},i0,w"E-mail address goes here...")'
FunctionEnd

Function SendFinishMail
${NSD_GetText} $EMailEdit $0
${If} $0 == "" ; TODO: Verify address by at least checking for *@*.*
    MessageBox mb_iconstop "You must enter a valid address!"
    Abort
${EndIf}
MessageBox mb_ok "TODO: Send mail to: $0"
FunctionEnd

...

!insertmacro MUI_PAGE_*
;Finish page
!define MUI_FINISHPAGE_RUN
  !define MUI_FINISHPAGE_RUN_TEXT 'Open Install Log'
  !define MUI_FINISHPAGE_RUN_NOTCHECKED
  !define MUI_FINISHPAGE_RUN_FUNCTION 'LaunchLog'
!define MUI_FINISHPAGE_SHOWREADME "" #Used as our email checkbox
  !define MUI_FINISHPAGE_SHOWREADME_TEXT "E-mail me some crap:"
  !define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED 
  !define MUI_FINISHPAGE_SHOWREADME_FUNCTION SendFinishMail
!define MUI_FINISHPAGE_LINK 'Click here to visit us at co.com.'
  !define MUI_FINISHPAGE_LINK_LOCATION http://www.co.com/
!define MUI_FINISHPAGE_TEXT_LARGE
!define MUI_FINISHPAGE_TEXT "text text text"
!define MUI_PAGE_CUSTOMFUNCTION_SHOW CustomizeFinishPage
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_LANGUAGE English