VB如何在模块hook全局热键 里面 实现 自身窗体按钮点击
发布网友
发布时间:2023-04-24 02:55
我来回答
共1个回答
热心网友
时间:2023-10-10 23:34
Public Function CallKeyHookProc(ByVal idHook As Long, ByVal wParam As Long, ByVal lParam As Long) As Long '钩子回调函数
Dim lKey As Long
Dim strLen As Long
If idHook = HC_ACTION Then
CopyMemory keyMsg, lParam, LenB(keyMsg)
Select Case wParam
Case WM_SYSKEYDOWN, WM_KEYDOWN '判断是否为键盘消息
Select Case keyMsg.vKey
Case 121 'f10
Command1_Click '可以这样直接用
//这里如何让 自身窗体的按钮自动点击
Case 123 'f12
Command2_Click '可以这样直接用
End Select
End Select
End If
CallKeyHookProc = CallNextHookEx(hHook, idHook, wParam, lParam) '呼叫下一个钩子
End Function