找回密码
 加入
搜索
查看: 1091|回复: 6

菜鸟请教一个关于热键使用的问题。

[复制链接]
发表于 2009-8-3 09:37:20 | 显示全部楼层 |阅读模式
本帖最后由 fast133 于 2009-8-4 10:18 编辑

做了一个autoit的小程序,里面定义了一个回车的热键。
然后只要开着这个小程序,我得操作系统里的回车功能就失效了。。。
比如选中了一个文件,单击回车,本来可以打开文件的,现在就没反应了。。


给为大鸟有解决的办法不?先谢谢了~
发表于 2009-8-3 10:10:16 | 显示全部楼层
这种做法不合理啊~,
 楼主| 发表于 2009-8-3 17:10:45 | 显示全部楼层
有人帮忙解决不?好困扰啊
发表于 2009-8-3 17:34:21 | 显示全部楼层
把那个热键做成组合键不就行了..................
发表于 2009-8-3 19:06:11 | 显示全部楼层
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
HotKeySet("{enter}","_Go")
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 292, 158, -1, -1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit

        EndSwitch
WEnd
Func _Go()
        If WinActive($Form1) Then
                MsgBox(0,0,"Enter热键起作用")
        Else
                HotKeySet("{enter}")
                Send("{enter}")
                HotKeySet("{enter}","_Go")
        EndIf
EndFunc
 楼主| 发表于 2009-8-4 08:57:15 | 显示全部楼层
谢谢ls的思路,明白了~
那如果在同一窗口某一控件有一个回车功能,另一个控件也设了一个回车的hotkey,
当然两个hotkey功能不一样,可以不?~
 楼主| 发表于 2009-8-4 10:15:20 | 显示全部楼层
自己想到解决办法了~参考了一个函数。用了类似顽固不化 的办法,只是聚焦到具体控件了。
再次谢谢顽固不化~!!

Func _IsFocused($hWnd, $nCID)
    Return ControlGetHandle($hWnd, '', $nCID) = ControlGetHandle($hWnd, '', ControlGetFocus($hWnd))
EndFunc

Func hotkey1()
;If WinActive($Form) Then
If _IsFocused($form, $searchnum) Then
                        ;MsgBox(0,0,"Enter热键起作用")
                        Send("!s")
        Else
                HotKeySet("{enter}")
                Send("{enter}")
                HotKeySet("{enter}","hotkey1")
        EndIf       

If _IsFocused($form, $listview) Then
                        ;MsgBox(0,0,"Enter热键起作用")
                        Send("!o")
        Else
                HotKeySet("{enter}")
                Send("{enter}")
                HotKeySet("{enter}","hotkey1")
        EndIf       
       
EndFunc
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-5-4 06:51 , Processed in 0.072450 second(s), 19 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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