🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.internet.web
Article #1315

Re: How can i disable TCppWebBrowser pop-up menu?

#1315
From: James O'Brien
Date: Tue, 22 Mar 2005 19:40
52 lines
2983 bytes
Hello,

If you simply want to disable the TCppWebBrowser pop-up menu you can use 
TApplicationEvents object for the main form
and create an OnMessage event handler to intercept WM_RBUTTONUP messages. 
You will need to determine for which window/control the WM_RBUTTONUP is 
bound.  The class name for TCppWebBrowser control as seen by windows is 
"Internet Explorer_Server".  If the class name for the window bound to the 
WM_RBUTTONUP message matches this, just set the Handled property to true and 
the TCppWebBrowser control won't receive the right-mouse click.
//****************************
//OnMessage  event handler
//****************************
void __fastcall TMainWnd::Main_AppEventMessage(tagMSG &Msg, bool &Handled)
{

  char WndClassName[MAX_PATH+2];

  switch(Msg.message){

     case WM_RBUTTONUP:
          GetClassName(Msg.hwnd, WndClassName, MAX_PATH);
          if( !strcmpi(WndClassName, "Internet Explorer_Server") )
                Handled = true;
          break;
      default:
          break;
   }

  return;
}
To be thorough, you would need to check for SHIFT+VK_F10 keyboard sequence 
since this will also display pop-up menu for window that has keyboard focus.

If you want to display a custom pop-up menu, you will probably need to know 
the context in which the menu is being called.  For this you will need to 
attach an event sink to the HTML document displayed in the TCppWebBrowser in 
order to know what HTML object is firing the event.   This can be done by 
creating an  TEventDispatcher object based on HTMLDocumentEvents or 
HTMLDocumentEvents2 event interface.  I've done this myself to trap events 
other then pop-up menus.  If you are interested in this approach let me know 
and I'll supply you with some code I've written. Are you at all familar with 
MSHTML?

Regards,
James O'Brien



"Marcelo Mello" <mrmello@pop.com.br> wrote in message 
news:42405ace$1@newsgroups.borland.com...
> How can i disable or change native TCppWebBrowser pop-up menu? 
Technical Details
Message-ID: <424074bc@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!newshub.sdsu.edu!logbridge.uoregon.edu!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <42405ace$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: feeec,7582e9bb14d23209
X-Google-Attributes: gidfeeec,public
X-Google-Language: ENGLISH,ASCII-7-bit
Reply-To: "James O'Brien" <obrien@niscnet.com>
From: "James O'Brien" <obrien@niscnet.com>
Newsgroups: borland.public.cppbuilder.internet.web
References: <42405ace$1@newsgroups.borland.com>
Subject: Re: How can i disable TCppWebBrowser pop-up menu? 
Date: Tue, 22 Mar 2005 14:40:42 -0500
Lines: 54
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-RFC2646: Format=Flowed; Response
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
NNTP-Posting-Host: 66.134.39.197
Message-ID: <424074bc@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1111520444 66.134.39.197 (22 Mar 2005 11:40:44 -0800)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!newshub.sdsu.edu!logbridge.uoregon.edu!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail