瑞星卡卡安全论坛技术交流区系统软件 如何在VB中调用API拦截键盘呢??

1   1  /  1  页   跳转

如何在VB中调用API拦截键盘呢??

如何在VB中调用API拦截键盘呢??

注意,是调用API,比如说在程序非激活状态下按入一个指定的键,然后激活程序为当前活动的程序。
先谢谢各位了。
最后编辑2006-03-09 22:21:54
分享到:
gototop
 

郁闷哦,有没有哪位大虾帮我出出主意呀??
gototop
 

大虾,能不能举个例子呀,我不是很明白哦。
gototop
 

在Form中加入
Private Declare Function GetAsyncKeyState Lib "user32" _
  (ByVal vkey As Long) As Integer

Private Function MyHotKey(vKeyCode) As Boolean
  MyHotKey = GetAsyncKeyState(vKeyCode) < 0
End Function

然后在循环中或Timer的Timer事件中检测:
  If myHotKey(vbkeyA) then .....



我觉得这个方法简单又好用,只要再加入一个API让热键按下后程序出现在最顶层就可以做一个呼出程序的热键了.
gototop
 
1   1  /  1  页   跳转
页面顶部
Powered by Discuz!NT