sunlitmanly 发表于 2010-10-8 14:28:47

给指定句柄发送点击消息

现在想后台实现360点击 点击的是360覆盖安装时弹出的确定窗口 现在已经证明 controlclick等无法实现自动点击 所以现在想发送消息 问题就是消息发送不对 希望大家指点指点
   代码如下
#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <WinAPI.au3>
Opt('MustDeclareVars', 1)
Opt("MouseCoordMode",2)
        Local $aWindows, $i, $text,$hWnd,$temp,$handle,$dll
Global $WM_LBUTTONDOWN      = 0x0201
Global $WM_LBUTTONUP         = 0x0202
        $aWindows = _WinAPI_EnumWindows()
        For $i = 1 To $aWindows
                $hWnd = $aWindows[$i]
                $text=_WinAPI_GetWindowText($hWnd)
                If $text="是"Then
                        If _WinAPI_GetWindowText(_WinAPI_GetParent($hWnd))="360产品" Then//确认360窗口句柄
                       MsgBox(0,"debug","find 360 windows!")
                                _WinAPI_PostMessage($hWnd,$WM_LBUTTONDOWN,0,0)             //发送左键按下消息
                                        _WinAPI_PostMessage($hWnd,$WM_LBUTTONUP,0,0)//发送鼠标左键抬起消息
       
                        EndIf
                EndIf
        Next

006001 发表于 2010-10-9 09:12:15

这个不是太懂了,还没学到。

menfan1 发表于 2010-10-9 11:41:20

API可以实现

sunlitmanly 发表于 2010-10-15 10:33:54

好像没人回答啊 楼上说是api 什么api 可否细讲

zps26 发表于 2010-10-15 15:45:12


#include <WinAPI.au3>
sleep(200)
WinActivate(_shi())
Send("{ENTER}")
Func _shi()
        Local $aWindows, $i, $text1, $text2, $text3
        $aWindows = _WinAPI_EnumWindows()
        For $i = 1 To $aWindows
                $text1 = $aWindows[$i]
                $text2 = $aWindows[$i]
                $text3 = WinGetTitle($aWindows[$i])
                If IsHWnd($text1) And $text2 = "Button" And $text3 = "是" Then
                        Return $text1
                        ExitLoop
                EndIf
        Next
EndFunc
页: [1]
查看完整版本: 给指定句柄发送点击消息