本帖最后由 xiehuahere 于 2012-8-8 15:19 编辑
帮助里说了,Autoit窗口总是隐藏的,你用GUICreate创建出来的是自己的用户窗口,不是AutoIt窗口。
用 AutoItWinGetTitle() 获取出来的总是“AutoIt v3”.
所以,改窗口标题要用 WinSetTitle 而不是 AutoItWinSetTitle.#include <GUIConstantsEx.au3>
$MGUI = GUICreate("HI,MAN", 300, 500)
$ok_btn = GUICtrlCreateButton("确定",50,420,60)
$exit_btn = GUICtrlCreateButton("退出",180,420,60)
GUISetState(@SW_SHOW)
while 1
$msg = GUIGetMsg()
Select
Case $msg = $ok_btn
$win_lab = WinList()
$list = ProcessList("notepad.exe")
If $list[0][0] = 0 or $list = 0 Then
MsgBox(0,"错误","没有运行notepad程序")
Else
for $i = 1 to $list[0][0] step + 1
if $list[$i][0] <> "" Then
WinSetTitle($MGUI, "", "My AutoIt Window")
sleep(2000)
EndIf
Next
EndIf
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $exit_btn
exitLoop
EndSelect
WEnd
|