var hMouseSecondButton: HHOOK; function MouseHookProc(nCode: Integer; wParam: WPARAM; lParam: LPARAM): LRESULT; stdcall; const IE_PROCNAME = 'Internet Explorer_Server'; var szClassName: array[0..255] of Char; MouseMsg: PMouseHookStruct; begin if nCode >= 0 then begin if (wParam = WM_RBUTTONDOWN) or (wParam = WM_RBUTTONUP) then begin GetClassName(PMouseHookStruct(lParam)^.hwnd, szClassName, SizeOf(szClassName)); if lstrcmp(@IE_PROCNAME[1], @szClassName[0]) = 0 then begin Result := HC_SKIP; Exit; end; end; end; Result := CallNextHookEx(hMouseSecondButton, nCode, wParam, lParam); end; procedure TfmMain.FormCreate(Sender: TObject); hMouseSecondButton := SetWindowsHookEx(WH_MOUSE, MouseHookProc, 0, GetCurrentThreadId); end; procedure TfmMain.FormDestroy(Sender: TObject); begin UnhookWindowsHookEx(hMouseSecondButton); end;