Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

WebBrowser popupmenu

Posted on 2004-03-23
2
Medium Priority
?
473 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
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…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

715 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