找回密码
 加入
搜索
查看: 2211|回复: 2

[GUI管理] (已解决)GUICtrlSetData 如何更改其他窗口的控件?

[复制链接]
发表于 2014-6-1 20:17:40 | 显示全部楼层 |阅读模式
本帖最后由 Chimecho 于 2014-6-3 02:01 编辑

有两个Au3实例,第一个创建了一个标签文本,第二个想使用GUICtrlSetData去更新第一个实例的标签的文本如何实现?谢谢各位!
发表于 2014-6-2 21:23:27 | 显示全部楼层
先运行1.au3,在运行2.au3,并点击2.au3中的按钮


第一个au3脚本
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("001", 460, 165, 192, 124)
$Label1 = GUICtrlCreateLabel("Label1", 224, 64, 36, 17)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit

        EndSwitch
WEnd


第二个au3脚本
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 615, 438, 192, 124)
$Button1 = GUICtrlCreateButton("Button1", 208, 128, 75, 25)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
                Case $Button1
                        ControlSetText ( "001", "", 3, "新文本"  )



        EndSwitch
WEnd

评分

参与人数 1金钱 +10 收起 理由
Chimecho + 10

查看全部评分

 楼主| 发表于 2014-6-3 02:01:14 | 显示全部楼层
就是ControlSetText啊,之前用过,不成功...貌似因为把控件ID写错了,非常感谢!
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-5-18 19:45 , Processed in 0.084706 second(s), 29 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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