Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vkey As Long) As IntegerPrivate Function MyHotKey(vKeyCode) As Boolean MyHotKey = (GetAsyncKeyState(vKeyCode) < 0) End Function Private Sub Timer1_Timer() If MyHotKey(vbKeyF12) Then MsgBox "F12" End Sub
Timer1.Interval = 1 Timer1.Enabled = True
to rainstormmaster(暴风雨 v2.0) 我要找的就是这个方法,可是如果 热键为 ctrl+c 的时候复制功能就不好用了,怎么解决呢
http://www.zjol.com.cn/vbbible/software/program/vb/ccw/htmapi90.htm
MyHotKey = (GetAsyncKeyState(vKeyCode) < 0)
End Function
Private Sub Timer1_Timer()
If MyHotKey(vbKeyF12) Then MsgBox "F12"
End Sub
Timer1.Enabled = True
你看该怎么办???
你看该怎么办???汗,你早说啊,可以这样:1)用钩子,这个你可以看:http://host.bluexp.net/vbgood/forum/forum_posts.asp?TID=13586
2)在子类中拦截WM_COPY和WM_PASTE等消息(如果复制,粘贴等操作是在你程序中进行的话),这个可以看:http://wwwb.pconline.com.cn/pcedu/empolder/gj/vb/doc/101120_api14.htm
3)如果可能的话,可以用vc写一个全局钩子,供vb调用
4)还有更复杂的实现方法,暂时就不说了