找回密码
 加入
搜索
查看: 1945|回复: 4

[GUI管理] GUICtrlCreateInput中的值无法读取

[复制链接]
发表于 2011-12-22 16:59:55 | 显示全部楼层 |阅读模式
我现在只有像下面这样才能读取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
发表于 2011-12-22 18:50:34 | 显示全部楼层
$url 只在开始赋值了一次,你以为它会随机应变?
发表于 2011-12-22 18:54:42 | 显示全部楼层
本帖最后由 gto250 于 2011-12-22 18:56 编辑

通过句柄获取input的值
你又没有赋值,肯定得空
 楼主| 发表于 2011-12-22 19:16:57 | 显示全部楼层
定义一个变量$xxx=GUICtrlRead($url),在msgbox中显示新变量

这样不行吗?
发表于 2011-12-22 19:18:56 | 显示全部楼层
定义一个变量$xxx=GUICtrlRead($url),在msgbox中显示新变量

这样不行吗?
nop 发表于 2011-12-22 19:16



    变量自己是不会变值的
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-9-20 20:44 , Processed in 0.081810 second(s), 24 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表