How to include and use text field in installer
I would like to incl开发者_如何学Cude license-check into my NSIS installer. Simple Text field and button would be enough for me, but I didn't find any example how to include Text field (text box) into page and how to read its value.
Will you help me with it, please?
I had this problem and found a different solution:
!include nsDialogs.nsh
!include LogicLib.nsh
...
Page custom MyPageFunc MyPageFuncLeave
...
Var txt
Var myTextBox
...
Function MyPageFunc
nsDialogs::Create 1018
${NSD_CreateLabel} 0 0 50u 10u "Username:"
${NSD_CreateText} 70 0 100u 12u ""
Pop $myTextBox
nsDialogs::Show
FunctionEnd
Function MyPageFuncLeave
${NSD_GetText} $myTextBox $txt
FunctionEnd
Later pages and their function then have access to $txt, which has the text from the textbox.
You can use this to create a text field :
!include nsDialogs.nsh
!include LogicLib.nsh
...
Var EDIT
...
${NSD_CreateText} 0 35 100% 12u SomeDefaultText
Pop $EDIT
And get the input (Not sure for this one) :
System::Call user32::GetWindowText(i$EDIT,t.r0,i${NSIS_MAX_STRLEN})
(As show in example\nsDialogs\example.nsi)
精彩评论