0

the problem is that after you hit ok on this GUI, it doesn't start the function I have.

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

I want it to obtain the input word, then save that as a variable and enter it into the later function OpenSHK()

Also when I run OpenSHK() Alone it works fine so it's not that.

4

1 回答 1

2

你在调用之前退出OpenSHK(),导致它永远不会被调用。

   Case $ButtonOk
      Exit
      OpenSHK()
EndSwitch

在调用之后退出:

   Case $ButtonOk
      OpenSHK()
      Exit
EndSwitch

第二个问题是$Password不是用户输入的密码;这是一个控制ID。您需要用于GuiCtrlRead检索用户在Ok单击按钮后输入的值。

于 2013-05-25T22:17:46.610 回答