时间: 2021-07-31 作者:daque
拜见以次代码:varform1 : tform;hookid : thandle;disablerbutton : boolean;implementationfunction mouseproc(ncode: integer; wparam,lparam: longint): longint; stdcall;function getclassnameenh(handle: hwnd): string;varclassname: pchar;buffer: integer;beginbuffer := 40;getmem(classname, buffer);windows.getclassname(handle, classname, buffer);result := classname;freemem(classname);end;varp: tpoint;beginif (ncode < 0) thenresult := callnexthookex(hookid, ncode, wparam, lparam)else if disablerbutton and ((wparam = wm_rbuttondown) or (wparam =wm_rbuttonup)) thenbegingetcursorpos(p);if pos('internet explorer_', getclassnameenh(windowfrompoint(p))) <> 0thenresult := hc_skipelseresult := callnexthookex(hookid, ncode, wparam, lparam);endelseresult := callnexthookex(hookid, ncode, wparam, lparam);end;procedure tform1.formcreate(sender: tobject);begindisablerbutton := true;hookid := setwindowshookex(wh_mouse, mouseproc, 0,getcurrentthreadid());end;procedure tform1.formdestroy(sender: tobject);beginif hookid <> 0 thenunhookwindowshookex(hookid);end;