How can i disable the menu of flash player when I'm navigating a flash file with WebBrowser ?
Asked
Active
Viewed 4,014 times
2 Answers
4
All messages that are sent to the WebBrowser, pass through your Delphi application as well, so by using a TApplicationEvents component and checking for the right-click event in the OnMessage event on the Handle of WebBrowser, or any of it's child handles (use IsChild) and set Handled, you should be able to block it.
The code could look like this
procedure TMyForm.ApplicationEvents1Message(var Msg: tagMSG;
var Handled: Boolean);
begin
if (Msg.message=WM_RBUTTONDOWN) and IsChild(WebBrowser1.Handle,Msg.hwnd) then
begin
PopupMenu1.Popup(Msg.pt.X,Msg.pt.Y);
Handled:=true;
end;
end;

Stijn Sanders
- 35,982
- 11
- 45
- 67
-
Thanks for response , may you give me an example ? – Kermia Nov 21 '10 at 16:35
1
Heres another way.
procedure TForm1.FormMouseActivate(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y, HitTest: Integer;
var MouseActivate: TMouseActivate);
begin
if Button=mbRight then
begin
if (x >= WebBrowser1.Left) and
(x <= WebBrowser1.Left + WebBrowser1.Width ) and
(y >= WebBrowser1.Top) and
(y <= WebBrowser1.Top + WebBrowser1.Height ) then
MouseActivate := maNoActivateAndEat;
end;
end;

Serkan Ekşioğlu
- 231
- 4
- 14