[Webinar] Streamline your web hosting managementRegister Today

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 247
  • Last Modified:

Disabling the right mouse button

I have an application that calls a COM (Component Object Model - like an Ole or an Active-X control) that I did not compile and therefore cannot change.  I am satisfied with everything the COM does in response to events from the keyboard or the mouse except when the right-mouse button is cliked.  Is there any way I can disable this button or make this button appear to be a left button so that a right-mouse button event will never be sent to the COM, but the left mouse button and keyboard events can be sent to the COM?
1 Solution
Juan_DiegoAuthor Commented:
Edited text of question.
What do you mean by "a COM"?
Juan_DiegoAuthor Commented:
Edited text of question.
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

With the classwizzard enable the WM_RBUTTONDOWN
code for the view that you're working with and simply
keep it empty.

This should enable you to not trigger or trigger you're own code
because this will trigger before the other code.

If the COM Object is in itself a view, then aggregate or contain the COM interface and overload the mouse right button function
this should also help but is a bit more tricky.
Juan_DiegoAuthor Commented:
Enabling the WM_RBUTTONDOWN did not work because the COM handles the input.  I was only able to get the enabled WM_RBUTTON function to work when I called SetCapture to allow my own view class to handle input, but then no other input (for example the left-mouse button) was sent to the COM.

More specifically, I am trying to make a browser that does not allow the user access to the options that come from Right-mouse clicking the page (such as View Source etc.).  I created a browser by simply picking CHtmlView as the view class instead of CView.  The CHtmlView class has a function Navigate2 which causes the browser to go to the URL passed to the function as an argument. In the code that they provide for us in the Navigate2 function, the COM m_pBrowser is called as follows:

      m_pBrowserApp->Navigate2(vURL, vFlags, vTargetFrameName,
            vPostData, vHeaders);

I am not familar with how to contain and overload COM's.  How could I overload the com m_pBrowserApp?
A host can replace the menus, toolbars, and context menus used by IE4 by implementing the IDocHostUIHandler interface.

Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now