找回密码
 加入
搜索
查看: 6114|回复: 8

[系统综合] 循环判断 如果鼠标右击,则鼠标左击空白处取消,如何实现?

  [复制链接]
发表于 2012-11-23 10:26:50 | 显示全部楼层 |阅读模式
悬赏10金钱已解决
本帖最后由 chase_100 于 2012-11-29 11:18 编辑

搜索到论坛中屏蔽鼠标右键的方法,感觉效果不太理想,我想通过循环判断当电脑使用者右键点击后,紧跟着在右键菜单外的地方左键点击一次或两次来将出现的右键取消;请各位前辈指教。

最佳答案

查看完整内容

[au3]#include HotKeySet('^`','_exit') $dll = DllOpen("user32.dll") While 1 Sleep(10) If _IsPressed(0x02,$dll) Then Do Sleep(10) Until Not _IsPressed(0x02,$dll) Send('{Esc}') EndIf WEnd Func _exit() DllClose($dll) Exit EndFunc[/au3]
发表于 2012-11-23 10:26:51 | 显示全部楼层
本帖最后由 annybaby 于 2012-11-24 23:08 编辑

#include <Misc.au3>
HotKeySet('^`','_exit')
$dll = DllOpen("user32.dll")
While 1
        Sleep(10)
        If _IsPressed(0x02,$dll) Then
                Do
                        Sleep(10)
                Until Not _IsPressed(0x02,$dll)
                Send('{Esc}')
        EndIf
WEnd

Func _exit()
DllClose($dll)
Exit
EndFunc
 楼主| 发表于 2012-11-23 13:22:37 | 显示全部楼层
没有人帮忙,自己顶一下
是不是钱太少了,本人还有25块,有谁知道怎么追加悬赏金额?????
发表于 2012-11-24 21:24:13 | 显示全部楼层
#include <Misc.au3>

$dll = DllOpen("user32.dll")
While 1
    Sleep ( 100 )
    If _IsPressed("01", $dll) Then
    Sleep ( 100 )
    Send("{ESC}")
    EndIf
WEnd
DllClose($dll)

评分

参与人数 1金钱 +10 收起 理由
chase_100 + 10 感谢第一个回答 _isppressed(&amp;quot;01&amp;quot;,$dll

查看全部评分

发表于 2012-11-25 00:15:17 | 显示全部楼层
楼主觉得哪个好用呢,我也期待中.....
发表于 2012-11-25 13:38:46 | 显示全部楼层
屏蔽按键去找找blockinputex udf
发表于 2012-11-25 17:38:17 | 显示全部楼层
IsPressed是什么函数
 楼主| 发表于 2012-11-29 11:12:48 | 显示全部楼层
感谢各位的热心回复,总结一下
_IsPressed(0x02,$dll) 用于判断右键
Send("{ESC}") 用于模拟键盘按下ESC,取消右键菜单
While 1
wend   用于循环判断
-----------------------------------------------------
6楼提供的参考blockinputex udf,因为在本论坛没有找到这个文件,baidu搜到一个英文网站下了一个
不知道是不是我下错了,还是我没理解;无法区分鼠标左右键,,我复制的blockinputex 前部分描述如下,请各位指点一下
; Name...........: _BlockInputEx
; Description ...: Disable/enable the mouse and/or keyboard. Supporting blocking (by include/exclude) of seperate keys.
; Syntax.........: _BlockInputEx( [iBlockMode [, sExclude [, sInclude [, hWindows]]]] )
; Parameters ....: $iBlockMode - Set the block mode. -1 = UnBlock all
;                                        1 = Block All
;                                        2 = Block only mouse;                                        3 = Block only keyboard
;                                        4 = Block only func keys
;                                        5 = Block only alpha keys
;                                        6 = Block only numeric keys
;                                        7 = Block only arrow keys
;                                        8 = Block only special keys
;                  $sExclude   - Keys hex-list (| delimited) to *exclude* when blocking (Only for keyboard blocking).
;                                 
  • All keys will be blocked, except the keys in $sExclude list.
    ;                                 [!] The hex keys list can be found in _IsPressed documentation section.
    ;                          [/] For $iBlockMode = 4 to 8, $sExclude will be enable for 1 / disabled for <> 1
    ;                  $sInclude   - Keys hex-list (| delimited) to *include* when blocking (Only for keyboard blocking).
    ;                                 
  • Only these keys will be blocked, the $sExclude ignored in this case.
    ;                                 [!] The hex keys list can be found in _IsPressed documentation section.
    ;                          [/] For $iBlockMode = 4 to 8, $sInclude will be enable for 1 / disabled for <> 1
    ;                  $hWindows   - Window handles list (| delimited) to limit the blocking process (Only for keyboard blocking).
    ; Return values .: Success     - 1.
    ;                  Failure     - 0 and set @error to 1. This can happend only when passing wrong parameters.
    ; Author(s)......: Rasim, MrCreator, FireFox
    ; Modified.......: MrCreator (15/01/09) ; FireFox (15/01/09)
    ; Remarks .......: This UDF includes OnAutoItExit function to release the callback/hooks resources.
    ;                    
  • See also native BlockInput() documentation.
    ; Related .......: BlockInput?
  • 发表于 2012-11-29 11:21:35 | 显示全部楼层
    左手习惯的用户可能会将鼠标左右键互换,此时_IsPressed(2)其实点击的是左键。
    严密些的话,可能要对鼠标左右键互换做判断,见注册表:RegRead("HKEY_CURRENT_USER\Control Panel\Mouse","SwapMouseButtons")
    您需要登录后才可以回帖 登录 | 加入

    本版积分规则

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

    GMT+8, 2024-5-18 23:43 , Processed in 0.082154 second(s), 24 queries .

    Powered by Discuz! X3.5 Licensed

    © 2001-2024 Discuz! Team.

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