首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VB >

如果 LowLevelKeyboardProc 函数解决方案

2012-01-12 
如果 LowLevelKeyboardProc函数PublicFunctionLowLevelKeyboardProc(ByValnCodeAsLong,ByValwParamAsLong,

如果 LowLevelKeyboardProc 函数
Public   Function   LowLevelKeyboardProc(ByVal   nCode   As   Long,   ByVal   wParam   As   Long,   ByVal   lParam   As   Long)   As   Long
Dim   kbdllhs   As   KBDLLHOOKSTRUCT         我想用里面的wParam这个参数,不知道该怎么调用

[解决办法]
天,你不会GOOGLE吗?

wParam是标志着消息类型!

Dim p As KBDLLHOOKSTRUCT

Public Function LowLevelKeyboardProc(ByVal nCode As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Dim fEatKeystroke As Boolean

If (nCode = HC_ACTION) Then
Debug.Print "FT "
If wParam = WM_KEYDOWN Or wParam = WM_SYSKEYDOWN Or wParam = WM_KEYUP Or wParam = WM_SYSKEYUP Then
CopyMemory p, ByVal lParam, Len(p)
fEatKeystroke = (p.vkCode = &H5B) Or ((p.vkCode = VK_TAB) And ((p.flags And LLKHF_ALTDOWN) <> 0)) Or ((p.vkCode = VK_ESCAPE) And ((p.flags And LLKHF_ALTDOWN) <> 0)) Or ((p.vkCode = VK_ESCAPE) And ((GetKeyState(VK_CONTROL) And &H8000) <> 0)) Or ((p.vkCode = vbKeyDelete) And ((GetKeyState(VK_CONTROL) And &H8000 <> 0) And (GetKeyState(vbKeyShift) And &H8000) <> 0))
End If
End If

If fEatKeystroke Then
LowLevelKeyboardProc = -1
Else
LowLevelKeyboardProc = CallNextHookEx(0, nCode, wParam, ByVal lParam)
End If
End Function

热点排行