如果是这样, 为何不注册一个AdlibRegister 函数来帮你呢,这个可不会死循环;
当然,是看你的用法!下面是我的想法:
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 623, 442, 192, 124)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
Global $winexists=0
AdlibRegister('_winexists',500)
AdlibRegister('_openthenotepad',3000)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
Func _WinExists()
If WinExists('无标题 - 记事本') Then
$winexists=1
MsgBox(64,'提示','现在窗口出现了,你可以使用变量 winexists 传递消息')
AdlibUnRegister('_winexists')
AdlibUnRegister('_openthenotepad')
WinClose('无标题 - 记事本')
EndIf
EndFunc
Func _openthenotepad()
Run('notepad.exe')
EndFunc
|