Here is an easier way to do it.
You'll need these two files: ieConst.pas 
{http://members.shaw.ca/iedelphi/downloads/source/ieConst.pas}
and IEDocHostUIHandler.pas. 
{http://members.shaw.ca/iedelphi/downloads/source/IEDocHostUIHandler.pas}
Add them to your uses clause.

Modify the IEDocHostUIHandler.pas file; in the ShowContextMenu 
method of the IDocHostUIHandler interface, you have to set the 
return value to S_OK and popup your own menu that has been assigned
to the WebBrowser's PopupMenu property:

function TDocHostUIHandler.IDocHostUIHandler_ShowContextMenu
  ( const dwID: DWORD;
    const ppt: PPOINT;
    const pcmdtReserved: IInterface;
    const pdispReserved: IDispatch
  ): HResult;
begin
  if Assigned(FWebBrowser.PopupMenu) then
    // tell IE we're handling the context menu
    Result := S_OK;
      // browser has a pop up menu so activate it
      FWebBrowser.PopupMenu.Popup(ppt.X, ppt.Y);
  end
  else
    // tell IE to use default action: display own menu
    Result := S_FALSE;
end;

--- Rich Cooper <[EMAIL PROTECTED]> wrote:

> Marvelous!  Thanks, Corey!  I don't begin to understand all the hook and
> unhook things going on here, but as long as it works, it solves the 
> immediate
> problem of disabling the standard TWebBrowser right click menu.
> 
> Now I have to figure out how to call the popup menu instead.  Does anyone
> have an idea on how to do that?
> 
> Thanks,
> Rich
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
__________________________________________________
Delphi-Talk mailing list -> Delphi-Talk@elists.org
http://www.elists.org/mailman/listinfo/delphi-talk

Reply via email to