| 发表于:2007-12-04 16:50:38 楼主 |
在窗体上有combo1,combo2,combo1屏蔽滚轮,combo2正常使用,但是当卸载钩子的时候提示错误"入口点 unhookwindowshookex in user32",帮我看看代码什么问题. 窗体代码: private sub combo1_gotfocus() lmousehook = setwindowshookex(wh_mouse_ll, addressof lowlevelmouseproc, app.hinstance, 0) end sub private sub combo1_lostfocus() if lmousehook <> 0 then unhookwindowshookex lmousehook end if end sub private sub form_load() combo1.additem "1" combo1.additem "2" combo1.additem "3" combo2.additem "1" combo2.additem "2" combo2.additem "3" end sub private sub form_queryunload(cancel as integer, unloadmode as integer) if lmousehook <> 0 then unhookwindowshookex lmousehook end if end sub 模块代码: public declare function setwindowshookex lib "user32" alias "setwindowshookexa" (byval idhook as long, byval lpfn as long, byval hmod as long, byval dwthreadid as long) as long public declare function unhookwindowshookex lib "user32" alias "unhookwindowshookex" (byval hhook as long) as long public declare function callnexthookex lib "user32" (byval hhook as long, byval ncode as long, byval wparam as long, lparam as any) as long type eventmsg message as long paraml as long paramh as long time as long hwnd as long end type private type pointapi x as long y as long end type public const wh_mouse_ll = 14 public const hc_action = 0 public const wm_mousewheel = &h20a public msgs as eventmsg public lmousehook as long public function lowlevelmouseproc(byval code as long, byval wparam as long, byval lparam as long) as long if code = hc_action then select case wparam case wm_mousewheel form1.caption = "mouse wheel" lowlevelmouseproc = -1 end select end if if code <> 0 then lowlevelmouseproc = callnexthookex(0, code, wparam, lparam) end if end function |
|
|
|
|