对于我的NSIS脚本,我需要一些用户信息,所以我有以下代码:
Function tomcatConfig
!insertmacro MUI_HEADER_TEXT "$(TEXT_CONF_TITLE)" "$(TEXT_CONF_SUBTITLE)"
nsDialogs::Create 1018
Pop $0
${NSD_CreateLabel} 0 2u 100u 14u "Tomcat shutdown port"
Pop $R0
${NSD_CreateText} 150u 0 50u 12u "8005"
Pop $CtlTomcatPortShutdown
${NSD_SetTextLimit} $CtlTomcatPortShutdown 5
${NSD_CreateLabel} 0 19u 100u 14u "Tomcat default http port"
Pop $R0
${NSD_CreateText} 150u 17u 50u 12u "80"
Pop $CtlTomcatPortHttp
${NSD_SetTextLimit} $CtlTomcatPortHttp 5
${NSD_CreateLabel} 0 36u 100u 14u "Tomcat default https port"
Pop $R0
${NSD_CreateText} 150u 34u 50u 12u "443"
Pop $CtlTomcatPortSSL
${NSD_SetTextLimit} $CtlTomcatPortSSL 5
${NSD_CreateLabel} 0 57u 140u 14u "Tomcat service name"
Pop $R0
${NSD_CreateText} 150u 55u 140u 12u "Servicename"
Pop $CtlTomcatServiceName
${NSD_SetFocus} $CtlTomcatPortShutdown
nsDialogs::Show
FunctionEnd
当我在我的脚本中使用$ CtlTomcatPortShutdown,$ CtlTomcatPortHttp,$ CtlTomcatPortHttp,$ CtlTomcatServiceName时,我得到一些随机数,而不是我期望的输入(服务名称,端口号等)。
EDIT;
来自NSIS NsDialog页面的此示例在Windows 10上看起来也是无效的,当我使用$ Text时,我也会返回一个随机数。
!include nsDialogs.nsh
!include LogicLib.nsh
Name nsDialogs
OutFile nsDialogs.exe
XPStyle on
Var Dialog
Var Label
Var Text
Page custom nsDialogsPage
Page instfiles
Function nsDialogsPage
nsDialogs::Create 1018
Pop $Dialog
${If} $Dialog == error
Abort
${EndIf}
${NSD_CreateLabel} 0 0 100% 12u "Hello, welcome to nsDialogs!"
Pop $Label
${NSD_CreateText} 0 13u 100% -13u "Type something here..."
Pop $Text
nsDialogs::Show
FunctionEnd
Section
DetailPrint "hello $Text"
SectionEnd
答案 0 :(得分:1)
$ {NSD_CreateXYZ}宏将handle(HWND)返回到堆栈上的控件,而不是随机数。此句柄可用于调用${NSD_GetText}
和${NSD_SetText}
等。