简体   繁体   中英

NSIS - add CreateText to MUI FINISH PAGE

I have an NSIS installer which at completion of the install sends an e-mail with a couple different logs attached. I'd like to allow the user to add their e-mail address to receive the e-mail and I'd like for them to enter it on the finish page because it seem most appropriate. How can I add a text box on the finish page for the user to enter their e-mail address into?

Here is my current finish 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_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
!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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM