0

我有一个 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
4

1 回答 1

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
于 2013-04-17T01:09:20.900 回答