找回密码
 加入
搜索
查看: 2150|回复: 2

[AU3基础] sendmessage函数问题

[复制链接]
发表于 2011-9-22 15:27:33 | 显示全部楼层 |阅读模式
Local Const $VK_RBUTTON =0x02 
        Local Const $WM_KEYDOWN = 0x0100
        Local Const $WM_KEYUP =0x0101 
               $hwnd = WinGetHandle('')
        DllCall("User32.dll","Int" ,"SendMessage","HWnd",$hwnd,"Int", $VK_RBUTTON,"Int",$WM_KEYDOWN,"int","0")
        DllCall("User32.dll","Int" ,"SendMessage","HWnd",$hwnd,"Int", $VK_RBUTTON,"Int",$WM_KEYUP,"int","1")
请教大侠们上述代码为何不能实现mouseclick("right")的效果?
发表于 2011-9-22 17:25:18 | 显示全部楼层
一个记事本例子
#include <winapi.au3>
Const $WM_RBUTTONDOWN = 0x204
Const $WM_RBUTTONUP = 0x205

Run("notepad.exe")
$Hwnd = WinWaitActive("[class:Notepad]")
$Hanld = ControlGetHandle($Hwnd,"","Edit1")
$Lparm = _WinAPI_MakeLong(100,105) ;x=100,y=105
;右键按下,弹起,弹出右键菜单
_SendMessage($Hanld,$WM_RBUTTONDOWN,0,$Lparm)
_SendMessage($Hanld,$WM_RBUTTONUP,0,$Lparm)
 楼主| 发表于 2011-9-22 18:59:13 | 显示全部楼层
回复 2# 风行者
#include <winapi.au3>
Const $WM_RBUTTONDOWN = 0x204
Const $WM_RBUTTONUP = 0x205
Run("notepad.exe")
$Hwnd = WinWaitActive("[class:Notepad]")
$Hanld = ControlGetHandle($Hwnd,"","Edit1")
$Lparm = _WinAPI_MakeLong(100,105) ;x=100,y=105
   DllCall("User32.dll","Int" ,"SendMessage","HWnd",$Hanld,"Int", $WM_RBUTTONDOWN,"Int",$WM_KEYDOWN,"int",$Lparm)
        DllCall("User32.dll","Int" ,"SendMessage","HWnd",$Hanld,"Int", $WM_RBUTTONUP,"Int",$WM_KEYUP,"int",$Lparm)
把$VK_RBUTTON换成$WM_RBUTTONDOWN,添加坐标,试了是可以达到了

不知道$VK_RBUTTON和$WM_RBUTTONDOWN区别在哪?
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-11-15 10:38 , Processed in 0.096439 second(s), 22 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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