//屏蔽右键菜单
procedure TForm1.ApplicationEvents1Message(var Msg: tagMSG;
var Handled: Boolean);
begin
with Msg do
begin
if not
IsChild(WebBrowser1.Handle, hWnd) then
Exit;
Handled :=
(message= WM_RBUTTONDOWN) or(message= WM_RBUTTONUP)
or(message=
WM_CONTEXTMENU);
end;
end;
//替换右键菜单
procedure
TForm1.ApplicationEvents1Message(var Msg:
tagMSG;
var Handled:
Boolean);
var pt: TPoint;
begin
if IsChild(WebBrowser1.Handle, Msg.Hwnd) and ((Msg.Message =
WM_RBUTTONDOWN) or(Msg.Message = WM_RBUTTONUP)) then
begin
GetCursorPos(pt); //得到光标位置
PopupMenu1.Popup(pt.X,
pt.Y); //弹出popupmenu1的菜单
Handled:=True;
end;
end;