Solved

WebBrowser popupmenu

Posted on 2004-03-23
2
462 Views
Last Modified: 2010-04-04
Hi

I set own Popupmenu to TWebbroswer, but i right click in browser, i get the standard browser popupmenu.
Why?

And how can i do?

Bobcsi
0
Comment
Question by:Bobcsi
2 Comments
 
LVL 2

Accepted Solution

by:
Ratje earned 125 total points
ID: 10656720
Here's a way to do it

var
 HMouseHook:THandle;

procedure TForm1.FormCreate(Sender: TObject);
begin
  HMouseHook   := SetWindowsHookEx(WH_MOUSE,@MouseProc,HInstance,GetCurrentThreadID);
end;

procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  CloseHandle(HMouseHook);
end;

function MouseProc( nCode: Integer; WP: wParam; LP: lParam ):Integer;stdcall;
var
  MHS:TMOUSEHOOKSTRUCT;
  WC:TWinControl;
  P:TPoint;
begin
  Result:=CallNextHookEx(HMouseHook,nCode,WP,LP);
  if nCode=HC_ACTION then
   begin
     MHS:=PMOUSEHOOKSTRUCT(LP)^;
     if ((WP=WM_RBUTTONDOWN) or (WP=WM_RBUTTONUP)) then
      begin
        WC:=FindVCLWindow(MHS.pt);
        if (WC is TWebBrowser) then
        begin
          Result:=1;
          P:=WC.ScreenToClient(MHS.pt);
          if WP=WM_RBUTTONDOWN then
            PostMessage(MHS.hwnd,WM_LBUTTONDOWN,0,P.x + P.y shl 16);
          if WP=WM_RBUTTONUP then
            PostMessage(MHS.hwnd,WM_LBUTTONUP,0,P.x + P.y shl 16);
          if (TWebBrowser(WC).PopupMenu<>nil) and (WP=WM_RBUTTONUP) then
           begin
            TWebBrowser(WC).PopupMenu.PopupComponent := WC;
            TWebBrowser(WC).PopupMenu.Popup(MHS.pt.x,MHS.pt.y);
           end
          else
            Result := 0 ;
        end;
      end;
   end;
end;
0
 
LVL 2

Author Comment

by:Bobcsi
ID: 10656803
Ohh, nice man:)

It's works:)

Fast men:)
THx

Bobcsi
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
indy tidtcpclient threading issue 8 63
Communication Between RC4 Delphi <-> PHP 3 99
delphi parse string to params 3 97
Performance of SQL statement 37 95
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

919 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now