找回密码
 加入
搜索
查看: 2180|回复: 4

[系统综合] 给指定句柄发送点击消息

  [复制链接]
发表于 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[0][0]
                $hWnd = $aWindows[$i][0]
                $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
发表于 2010-10-9 09:12:15 | 显示全部楼层
这个不是太懂了,还没学到。
发表于 2010-10-9 11:41:20 | 显示全部楼层
API可以实现
 楼主| 发表于 2010-10-15 10:33:54 | 显示全部楼层
好像没人回答啊 楼上说是api 什么api 可否细讲
发表于 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[0][0]
                $text1 = $aWindows[$i][0]
                $text2 = $aWindows[$i][1]
                $text3 = WinGetTitle($aWindows[$i][0])
                If IsHWnd($text1) And $text2 = "Button" And $text3 = "是" Then
                        Return $text1
                        ExitLoop
                EndIf
        Next
EndFunc  
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-5-20 03:09 , Processed in 0.081518 second(s), 25 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表