VB按键事件

来源:百度知道 编辑:UC知道 时间:2024/05/30 17:38:46
我想知道怎么接受按键,就那“a”说,
当按下a的时候是什么事件,松开a是什么事件,
要能在非当前窗口都可以运行响应事件
谢谢。。

Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer '声明

Private Sub Timer1_Timer()
If GetAsyncKeyState(65) = -32767 Then MsgBox "按下了a键"
End Sub

要能在“非当前窗口都可以运行响应事件”,这好像挺难做到,除非你在每个窗体都放一个相同控件,调用一个相同的事件过程。