原帖由 powerofos 于 2008-7-9 18:47 发表
没加判断的话,比 顽固不化 提供的方法还要闪~
帮你改了
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 357, 124, 193, 125)
$Button1 = GUICtrlCreateButton("按钮1", 16, 16, 161, 33, 0)
$Button2 = GUICtrlCreateButton("按钮2", 16, 72, 161, 33, 0)
$Edit1 = GUICtrlCreateEdit("", 200, 16, 145, 89)
GUICtrlSetData(-1, "捕获移动示例," & @CRLF & "BY 顽固不化")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg(1)
Switch $nMsg[0]
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
GUICtrlSetData($Edit1, "干'按钮1'的事去吧")
Case $Button2
GUICtrlSetData($Edit1, "干'按钮2'的事去吧")
EndSwitch
$mousepos = GUIGetCursorInfo($Form1)
Switch $mousepos[4]
Case $Button1
setinfo($Edit1, "鼠标在第一个按钮上")
Case $Button2
setinfo($Edit1, "鼠标在第二个按钮上")
Case Else
setinfo($Edit1, "捕获移动示例," & @CRLF & "BY 顽固不化")
EndSwitch
WEnd
Func setinfo($ctrlid,$txt)
if GUICtrlRead($ctrlid)<>$txt Then
GUICtrlSetData($ctrlid,$txt)
EndIf
EndFunc
|