| 发表于:2007-04-15 17:01:37 楼主 |
我想捕捉系统的ctrl+q消息,但我不能解析出ctrl对应的键q,代码如下 public type eventmsg vkey as long skey as long flag as long time as long end type public mymsg as eventmsg '钩子函数 public function mykbhook(byval ncode as long, byval wparam as long, byval lparam as long) as long dim intshift as long if ncode > = 0 then intshift = 0 mykbhook = 0 if wparam = wm_keydown then '判断出ctrl键是否使用 if getasynckeystate(vbkeycontrol) then intshift = (intshift or 2) copymemory mymsg, byval lparam, len(mymsg) if mymsg.vkey = 76 and (intshift = 2) then mykbhook = 1 end if end if end if call callnexthookex(hhook, ncode, wparam, lparam) '将消息传给下一个钩子 end function '挂接钩子 hhook = setwindowshookex(wh_keyboard_ll, addressof mykbhook2, app.hinstance, 0) 但在按下ctrl+q之后,捕捉解析的消息mymsg.vkey =162 mymsg.skey = 29 我看有些介绍说应该为mymsg.vkey = 76 ,请各位高手帮忙谢谢! |
|
|
|
|