2008年7月15日 星期二

Check Keyboard Hook #1

Implements IWindowsHook

Private Sub Form_Load()
InstallHook Me, WH_KEYBOARD
End Sub

Private Sub Form_QueryUnload( _
Cancel As Integer, UnloadMode As Integer)
RemoveHook Me, WH_KEYBOARD
End Sub

Private Function IWindowsHook_HookProc( _
ByVal eType As EHTHookTypeConstants, _
ByVal nCode As Long, _
ByVal wParam As Long, _
ByVal lParam As Long, _
bConsume As Boolean _
) As Long

If KeyBoardlParam(lParam).KeyDown Then
If Me.ActiveControl is Text1 Then
txtTest.SelText = " "
bConsume = True
End If
End If
End Function

沒有留言: