无法读取GUICtrlCreateInput里面的文本内容?
本帖最后由 大建子1 于 2011-1-14 17:18 编辑像题目所述,无法获取GUICtrlCreateInput里面输入的文本内容。源码如下:#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 351, 162, 298, 126)
$Input1 = GUICtrlCreateInput("Input1", 120, 48, 185, 21)
$Button1 = GUICtrlCreateButton("Button1", 88, 96, 105, 41)
$ceshi = GUICtrlCreateLabel("ceshi", 72, 48, 37, 25)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
Dim $a
$a=GUICtrlRead($Input1)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
MsgBox(0,"ceshi",$a)
EndSwitch
WEnd
点击Button1所得出的结果还是Input1 我想如果我在输入框里面输入12345,让读取出来的结果也是“12345”,无法实现,不知道是那里出了错。麻烦哪位大大如果知道的话教授一下。 #include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 351, 162, 298, 126)
$Input1 = GUICtrlCreateInput("Input1", 120, 48, 185, 21)
$Button1 = GUICtrlCreateButton("Button1", 88, 96, 105, 41)
$ceshi = GUICtrlCreateLabel("ceshi", 72, 48, 37, 25)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
;Dim $a
;$a=GUICtrlRead($Input1)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
MsgBox(0,"ceshi",GUICtrlRead($Input1))
EndSwitch
WEnd 这两句
Dim $a
$a=GUICtrlRead($Input1)
可能就让$a的值定死掉了 本帖最后由 5i5wei 于 2011-1-14 16:27 编辑
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 351, 162, 298, 126)
$Input1 = GUICtrlCreateInput("", 120, 48, 185, 21)
$Button1 = GUICtrlCreateButton("Button1", 88, 96, 105, 41)
$ceshi = GUICtrlCreateLabel("ceshi", 72, 48, 37, 25)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
Local $a
While 1
$nMsg = GUIGetMsg()
$a=GUICtrlRead($Input1,0)
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
MsgBox(0,"ceshi",$a)
EndSwitch
WEnd
把这句放在while里面 $a=GUICtrlRead($Input1,0) 3楼正解 你如果非要定义的话 就用我这种方法 回复 2# papapa314
谢谢了,让我有学习到了。 回复 5# 5i5wei
谢谢。有学习到新知识了。
页:
[1]