发表评论(0)作者:, 平台:, 阅读:11452, 日期:2000-03-12
问题:怎样在软件中设定热键呢?就像抓图软件一样,无论窗体活不活动只要按下热键就可执行一定功能。
答:可以用API,在Form中加入
Private Declare Function GetAsyncKeyState Lib ″user32″ Alias ″GetAsyncKeyState″ (Byval vkey as Long) as integer
Private Function MyHotKey(vKeyCode) As Boolean
MyHotKey=((GetAsyncKeyState(vKeyCode)<0)
End Function
然后在循环中或Timer的Timer事件中检测:
If myHotKey(vbkeyA) then .....
其中vbkeyA是键盘″A″的常数,其他键可按F1查得。
答:可以用API,在Form中加入
Private Declare Function GetAsyncKeyState Lib ″user32″ Alias ″GetAsyncKeyState″ (Byval vkey as Long) as integer
Private Function MyHotKey(vKeyCode) As Boolean
MyHotKey=((GetAsyncKeyState(vKeyCode)<0)
End Function
然后在循环中或Timer的Timer事件中检测:
If myHotKey(vbkeyA) then .....
其中vbkeyA是键盘″A″的常数,其他键可按F1查得。