QQ2009版本自动接收文件
思路:
1.监视托盘图标文字,当企鹅图标变成对方头像就会title变空
2.由于QQ2009特殊控件问题,只能以相对坐标模拟点击方式自动接收文件
注意:每个人的窗口‘接收‘坐标不一定一致,根据自己情况再修改
MouseClick("left", $size[0]+421, $size[1]+164, 1)中的X:421 Y:164
3.经过检测是可行的,但有些细节未处理
例如接收完自动winclose窗口...
#Include <GuiToolBar.au3>
#include <winapi.au3>
Local $iProcessID
While 1
Sleep(2000)
If _SysTray_ClickItem("", "left", 2)=1 Then
MsgBox(0,0,0)
$pid=ProcessExists("QQ.exe")
Sleep(1000)
$wlis=WinList()
for $i=1 to $wlis[0][0]
if $wlis[$i][0]<> "" AND IsVisible($wlis[$i][1]) then
_WinAPI_GetWindowThreadProcessId($wlis[$i][1], $iProcessID)
If not StringCompare($iProcessID,$pid) AND not StringInStr($wlis[$i][0], "QQ")then
WinActivate($wlis[$i][0])
$size = WinGetPos($wlis[$i][0])
MouseClick("left", $size[0]+421, $size[1]+164, 1)
EndIf
EndIf
Next
EndIf
WEnd
Func _SysTray_ClickItem($iTitle, $iButton = "left", $iClick = 2)
Local $hToolbar, $iButCount, $aRect, $i
$hToolbar = ControlGetHandle('[Class:Shell_TrayWnd]', '', '[Class:ToolbarWindow32;Instance:1]')
$iButCount = _GUICtrlToolbar_ButtonCount($hToolbar)
For $i = 0 To $iButCount - 1
$cID = _GUICtrlToolbar_IndexToCommand($hToolBar, $i)
If _GUICtrlToolbar_GetButtonText($hToolBar, $i)='' Then
MsgBox(0,0,'1')
$aRect = _GUICtrlToolbar_GetButtonRect($hToolBar, $i)
ControlClick("[Class:Shell_TrayWnd]", "", "ToolbarWindow321", $iButton, $iClick, $aRect[0], 5)
$aRect = 0
Return 1
Else
EndIf
Next
EndFunc
Func IsVisible($handle)
If BitAnd( WinGetState($handle), 2 ) Then
Return 1
Else
Return 0
EndIf
EndFunc
|