if hnexthookproc <> 0 then
unhookwindowshookex hnexthookproc
hnexthookproc = 0
end if
end sub
public function enablekbdhook() ‘设置键盘hook
if hnexthookproc <> 0 then
exit function
end if
hnexthookproc = setwindowshookex(wh_keyboard, addressof _
mykbhfunc, app.hinstance, 0)
if hnexthookproc <> 0 then
enablekbdhook = hnexthookproc
end if
end function
public function mykbhfunc(byval icode as long, _
byval wparam as long, byval lparam as long) as long
mykbhfunc = 0
if icode < 0 then
mykbhfunc = callnexthookex(hnexthookproc, icode, wparam, lparam)
exit function
end if