问题是,在这个GUI上点击确定后,它没有启动我的功能。
Func BeginningGUI()
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Stronghold Kingdoms", 248, 95, -1, -1)
$Password = GUICtrlCreateInput("Password", 8, 32, 233, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_PASSWORD))
$ButtonOk = GUICtrlCreateButton("OK", 86, 64, 75, 25, $BS_NOTIFY)
$ButtonCancel = GUICtrlCreateButton("Cancel", 167, 64, 75, 25, $BS_NOTIFY)
$EnterPassLabel = GUICtrlCreateLabel("Please Enter Your Stronghold Kingdoms Password", 0, 12, 241, 17, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $ButtonCancel
Exit
Case $ButtonOk
Exit
OpenSHK()
EndSwitch
WEnd
EndFunc
我希望它获取输入词,然后将其保存为变量并将其输入到后面的函数OpenSHK()
此外,当我运行OpenSHK()时,它运行正常,所以不是那样。
答案 0 :(得分:2)
您在调用OpenSHK()
之前退出,导致永远不会被调用。
Case $ButtonOk
Exit
OpenSHK()
EndSwitch
在拨打电话后退出:
Case $ButtonOk
OpenSHK()
Exit
EndSwitch
第二个问题是$Password
不是用户输入的密码;它是一个控件ID。您需要使用GuiCtrlRead
来检索用户在点击Ok
按钮后输入的值。