回复 2# 66343022
用这个试试,用它拿去修改吧,这里有一个缺点就是会移动几下鼠标Global $h_QQ
Local $var = WinList()
For $i = 1 To $var[0][0]
; 只显示有标题的可见窗口
If $var[$i][0] <> "" And IsVisible($var[$i][1]) Then
;MsgBox(0, "详细信息", "标题 = '" & $var[$i][0] & "'" & @LF & "句柄 ='" & $var[$i][1] & "'")
If StringRegExp($var[$i][0], "QQ201") Then
;搜寻QQ窗体,并找到句柄
$h_QQ = $var[$i][1]
EndIf
EndIf
Next
Func IsVisible($handle)
If BitAND(WinGetState($handle), 2) Then
Return 1
Else
Return 0
EndIf
EndFunc ;==>IsVisible
Sleep(2000)
; 激活QQ窗体
$sRtn = WinActivate($h_QQ, "")
If $sRtn = 0 Then
MsgBox(0, "Error!", "激活QQ窗体失败!")
Exit
EndIf
; 获得QQ登录窗体的位置
$aTemp = WinGetPos($h_QQ)
$iQQx = $aTemp[0]
$iQQy = $aTemp[1]
; 保存当前鼠标位置
$aTemp = MouseGetPos()
$ix = $aTemp[0]
$iy = $aTemp[1]
;=== 移动鼠标,根据对目标窗体的特征点的鼠标光标来判断是否检测到目标窗体
$str = ""
MouseMove(280 + $iQQx, 96 + $iQQy)
$iRtn = MouseGetCursor()
$str = $str & $iRtn
;ConsoleWrite("$iRtn is " & $iRtn & @CRLF)
MouseMove(280 + $iQQx, 200 + $iQQy)
$iRtn = MouseGetCursor()
$str = $str & $iRtn
;ConsoleWrite("$iRtn is " & $iRtn & @CRLF)
MouseMove(280 + $iQQx, 230 + $iQQy)
$iRtn = MouseGetCursor()
$str = $str & $iRtn
;ConsoleWrite("$iRtn is " & $iRtn & @CRLF)
If $str = "5216" Then
MsgBox(0, "Note", "验证码出现!")
EndIf
|