Disable Right Click Context Menu in WebBrowser Control



  • 1. Need recommendation for VC++
    Hi dear experts, I'm not experienced in VC++ but i have VC++ 6.0 just for a very few experience. I'm confused and i need to know someting about C++ application development under VC++ 6 or more. Here to go: 1-Is the most efficent way to develop GUI-based applications possible with MFC or what else? What's MFC used for? 2-What's the best way to learn VC++ or C++ with Windows app. developing? Which books? Web tutorials? There are some and a few free tutorials which are very fragmented and need to know which dicipline or procedure(s) is/are the most strong steps to learn VC++ ? I appreciate if you had useful steps till right now with your experiences. 3-When compared to Basic, VC++ or C++ seems much more complicated and has more mistake rist while coding, that's why i'm a bit concerned, so what are the basics understanding of Visual C++ enviroment/C++ ? (For example: Declarations, strings, using variables...) These can be generated more, so please post your feedback in order to undertand about VC++ coding disipline, recognizing enviroment and programming basics/tricks to make explicit things. Regards...
  • 2. Tree icons not displayed when XP styles are set
    Hello Since we are using VS2005 instead of VS2003 our program does not display tree icons when using the XP styles. If I change the manifest so that the "new" mscomctl32.dll is not used everything works fine. W2K is fine too. When changing from 2003 to 2005 suddenly manifests became more of an issue but I can't see how manifests could cause that problem. I searched the internet about this problem and the few things I found said that there might be an incompatibility between the different mscomctl32 versions and indeed my program loads two different mscomctl32.dll. Any ideas/help greatly welcome Thanks in advance Thomas
  • 3. bit field serialization
    Where can I find example code showing serialization of a bit field in MFC? I built a bit field class derived from CObject and see in the VC++ documentation how to IMPLEMENT_SERIAL. However, I can not seem to figure out how to write the void CMyBitField::Serialize( CArchive& archive) { if( archive.IsStroring() ) { archive << <unsigned int> bits << etc. ????? } else { archive >> ???? ) } -- Thank you very much, Greg G
  • 4. How to check the Window's state if it is maximized?
    I am creating an SDI application where I am creating a new class CMyClass derived from CWnd Class. Now, I am creating a window of that class. I have to check if its state is maximized it should change its size when I resize my Parent(Main) Window. Anyways if its not maximized I have to retain the original size even though I resize the main window. My Question is that how can we determine if the Window's state is maximized or not? I hope I m clear. Thanks in advance for your valuable help.
  • 5. What message when deactivating dialog.
    I would like to find out what message id sent when user deactivates a dialog. This is usually the case when the user clicks the mouse button outside the dialog window and the title bar becomes gray (instead blue, as usual). I couldn't find this information in MSDN. Thanks for any hints, Pshemek

Disable Right Click Context Menu in WebBrowser Control

Postby luking » Thu, 23 Jul 2009 02:05:25 GMT

Hi all,

I am creating a simple dialog box with WebBrowser Control, and try to
suppress Context menu when righ clicking. I have done a lot of google
search and got to know have to implement
IDocHostUIHandler::ShowContextMenu interface for that purpose, but
never got a sample of the implementation with a WebBrowser in a dialog
form, Maybe I am in the wrong direction. Can anybody give me a hint?
Here is a pice of code that I have got, I don't know how to
incorporate it with the WebControl I have added in the dialog box.
Thanks you so much!!!

HRESULT IDocHostUIHandler::ShowContextMenu(
€€ DWORD dwID,
€€ POINT *ppt,
€€ IUnknown *pcmdtReserved,
€€ IDispatch *pdispReserved

Re: Disable Right Click Context Menu in WebBrowser Control

Postby Ajay » Thu, 23 Jul 2009 05:36:58 GMT

This shows the steps you need to take for CHTMLView. You need to do
the same for your control:



Re: Disable Right Click Context Menu in WebBrowser Control

Postby Ajay » Thu, 23 Jul 2009 05:47:00 GMT

Another way is shown here(probably easier):



Similar Threads:

1.How to disable the shortcut for context menu(right mouse clicking menu)


    When creating the context menu with English Character
such as

    - Copy -
    - Delete -

When the menu pops, pushing the char 'C' and 'D on keyboard,
the corresponding messaage handler will be called directly;

So how can I disable this calling when the 'C' and 'D' chars is clicked when
menu pops?

Thank you!


2.Context Menu Click event - how to Identify the object that was right clicked

I have a context menu which is shared between a TreeView and ListView
control (both controls show the same information, similar to how
Windows Explorer works, so it makes sense to use the same menu on both

What i'm struggling to do when the menuItem_Click event is fired, is
to detect the TreeNode or ListViewItem that was originally right
clicked when the context menu was opened.

I can't just look at the selected item, because I don't even know in
which control the context menu was initiated. Can anyone offer any

I could easily store a copy of the TreeNode or ListViewItem in the
menu tag, but the _Click event doesn't seem to provide a means of
accessing the menu via the sender variable.


3.disable right click of WebBrowser control


I am using the WebBrowser control in my application, and now I want to
disable the menu that pops up when using the right mouse button.

I'm not sure how to do this, since I cannot find the proper events for this.
Do I need to add my own event handler? If yes, how can I do this in VB .NET?

Thanks in advance,

4.Disable right click context menu on desktop without registry

5.Disabling the right click context menu (revisited)

I have downloaded the demo from MS. There is this code in the control:

' Enable or disable IE's context menu? This allows the parent host
' to render its own.
Public Property BrowserContextMenu() As Boolean
        BrowserContextMenu = enableCtxMenu
    End Get
    Set(ByVal Value As Boolean)
        ' Disable it. Note that we'll need to do this for each
        ' page navigation, as the event sink is specific to an
        ' instance of MSHTML.
        If (True = Value) Then
        End If
            enableCtxMenu = Value
    End Set
End Property

What do I set to make this disable the context menu? This is literally the
last thing I need to finish the application.


6. Disable Outlook 2003 right click context menu

7. Right Click context menu sometimes disables "Go To Definition" using VSl.NET 2005

8. Disabling context menu(right clicks) on the quick launch toolbar

Return to VC


Who is online

Users browsing this forum: No registered users and 75 guest