Chimecho 发表于 2014-6-1 20:17:40

(已解决)GUICtrlSetData 如何更改其他窗口的控件?

本帖最后由 Chimecho 于 2014-6-3 02:01 编辑

有两个Au3实例,第一个创建了一个标签文本,第二个想使用GUICtrlSetData去更新第一个实例的标签的文本如何实现?谢谢各位!

gto250 发表于 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

Chimecho 发表于 2014-6-3 02:01:14

就是ControlSetText啊,之前用过,不成功...貌似因为把控件ID写错了,非常感谢!
页: [1]
查看完整版本: (已解决)GUICtrlSetData 如何更改其他窗口的控件?