Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

WebBrowser popupmenu

Posted on 2004-03-23
2
Medium Priority
?
475 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 500 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses

772 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