nop 发表于 2011-12-22 16:59:55

GUICtrlCreateInput中的值无法读取

我现在只有像下面这样才能读取GUICtrlCreateInput中的值,
如果我写成$url = GUICtrlRead(GUICtrlCreateInput("", 112, 16, 121, 21)),msgbox中直接显示$url,那就会显示为空
如果我重新定义一个变量$xxx=GUICtrlRead($url),在msgbox中显示新变量,同样为空,为什么啊?#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=C:\Documents and Settings\Administrator.NOP\桌面\Form1.kxf
$Form1 = GUICreate("0000", 248, 196, 369, 201)
$url = GUICtrlCreateInput("", 112, 16, 121, 21)
$Button1 = GUICtrlCreateButton("确定", 32, 136, 75, 25)
$Button2 = GUICtrlCreateButton("取消", 136, 136, 75, 25)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###


While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
               
                Case $Button2
                        Exit
                Case $Button1
                        MsgBox(0,"",GUICtrlRead($url))
                       
                       
                        GUIDelete($Form1)
                        GUISetState(@sw_hide,$Form1)
                       
                       
                       
        EndSwitch
WEnd

afan 发表于 2011-12-22 18:50:34

$url 只在开始赋值了一次,你以为它会随机应变?

gto250 发表于 2011-12-22 18:54:42

本帖最后由 gto250 于 2011-12-22 18:56 编辑

通过句柄获取input的值
你又没有赋值,肯定得空

nop 发表于 2011-12-22 19:16:57

定义一个变量$xxx=GUICtrlRead($url),在msgbox中显示新变量

这样不行吗?

afan 发表于 2011-12-22 19:18:56

定义一个变量$xxx=GUICtrlRead($url),在msgbox中显示新变量

这样不行吗?
nop 发表于 2011-12-22 19:16 http://www.autoitx.com/images/common/back.gif


    变量自己是不会变值的
页: [1]
查看完整版本: GUICtrlCreateInput中的值无法读取