|
发表于 2010-8-26 12:24:07
|
显示全部楼层
本帖最后由 sanmoking 于 2010-8-26 14:57 编辑
直接调出退出面板,然后点击退出,
另外发现那个退出面板需要用户曾经点击过才会出现,所以当发现有tm窗口却没有那个退出面板的话,模拟用户手动点一下.直到所有的tm,qq退出...
该代码唯一的缺陷就是,如果点击的位置前面有个更高权限的置顶窗口就会是点击失效.....我已经尽力了.top()
HotKeySet("`", "mimi")
Func mimi()
While WinExists("TM") or ProcessExists("TM.EXE")
$num = 0
$list = WinList("TXMenuWindow")
if $list[0][0] > 0 then
For $i = 1 To $list[0][0]
$x = WinGetPos($list[$i][1])
If $x[2] = 132 And $x[3] = 261 Then
$a = 0
$b = 0
WinMove($list[$i][1], "", $a, $b)
WinSetState($list[$i][1], "", @SW_SHOW)
$s = MouseGetPos()
top($list[$i][1])
MouseClick("left", $a + 20, $b + 210, 1, 0)
MouseMove($s[0], $s[1], 0)
$num = $num + 1
Sleep(100)
ContinueLoop(2)
EndIf
Next
If $num = 0 Then
$y = WinGetPos("TM")
WinMove("TM", "", 0, 0)
WinSetState("TM", "", @SW_SHOW)
$x = WinGetPos("TM")
$s = MouseGetPos()
top(WinGetHandle ("TM"))
MouseClick("left", 20, $x[3] - 20, 1, 0)
WinMove("TM", "", $y[0],$y[1],$y[2],$y[3])
MouseMove($s[0], $s[1], 0)
EndIf
EndIf
WEnd
While WinExists("QQ") or ProcessExists("QQ.EXE")
$num = 0
$list = WinList("TXMenuWindow")
if $list[0][0] > 0 then
For $i = 1 To $list[0][0]
$x = WinGetPos($list[$i][1])
If $x[2] = 147 And $x[3] = 288 Then
$a = 0
$b = 0
WinMove($list[$i][1], "", $a, $b)
WinSetState($list[$i][1], "", @SW_SHOW)
$s = MouseGetPos()
top($list[$i][1])
MouseClick("left", $a + 20, $b + 230, 1, 0)
MouseMove($s[0], $s[1], 0)
$num = $num + 1
Sleep(100)
ContinueLoop(2)
EndIf
Next
If $num = 0 Then
$y = WinGetPos("QQ")
WinMove("QQ", "", 0, 0)
WinSetState("QQ", "", @SW_SHOW)
$x = WinGetPos("QQ")
$s = MouseGetPos()
top(WinGetHandle ("TM"))
MouseClick("left", 20, $x[3] - 20, 1, 0)
WinMove("QQ", "", $y[0],$y[1],$y[2],$y[3])
MouseMove($s[0], $s[1], 0)
EndIf
EndIf
WEnd
Exit
EndFunc ;==>mimi
func top($hdl);把窗口放到最前端.
$hw=_WinAPI_GetForegroundWindow()
If $hw<>$hdl Then
_WinAPI_SetWindowPos($hw, -2, 0, 0, 0, 0, 3)
EndIf
_WinAPI_SetWindowPos($hdl, -1, 0, 0, 0, 0, 3)
EndFunc
|
|