# to CWW: 关于 KeyBoard Hook

Posted by 七枷社 on December 21, 1998 at 18:13:17:

In Reply to: 需subclass的技巧 posted by cww on December 17, 1998 at 08:10:04:

: 查一下http://sunh.hosp.ncku.edu.tw/~cww
: 中有相对的文章

谢谢，有关问题我已经解决了。 关于您的 Keyboard hook.我加了一个 timer control.就不会影响到其它程式的运行。

程式：

public kbdhook as boolean
dim const VK_CONTROL = &H11

private sub form_activate()
time1.enable=true
end sub

private sub form_deactivate()
time1.enable=false
end sub

private sub time1_timer()
If GetKeyState(VK_Control) < 0 Then
Call EnableKBDHook
KbdHook = True
Else
If KbdHook = True Then
Call UnHookKBD
KbdHook = False
End If
End If
End Sub

Follow Ups: