Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Context menu in CHTMLView-based application

Posted on 2000-03-24
9
Medium Priority
?
574 Views
Last Modified: 2009-07-29
My application based on CHTMLView class, and I need to create my own context menu instead of default context menu for this view. I am trying to implement it in WM_CONTEXTMENU handler, but application does not reach this point.
0
Comment
Question by:vvm101
  • 5
  • 4
9 Comments
 
LVL 23

Expert Comment

by:chensu
ID: 2655366
You need to implement the IDocHostUIHandler interface. See

Driller (MFC) Sample
http://msdn.microsoft.com/downloads/c-frame.htm?953938653415#/downloads/samples/internet/browser/driller/default.asp
0
 

Author Comment

by:vvm101
ID: 2655388
This example explains the way to disable default menu. But I don't understand how to implement my own menu.
0
 
LVL 23

Expert Comment

by:chensu
ID: 2655455
You can use CMenu::TrackPopupMenu to show your menu.

Building a Dynamic Menu for TrackPopupMenu
http://support.microsoft.com/support/kb/articles/Q105/1/69.asp

HOWTO: Mirror Main Menu with TrackPopupMenu()
http://support.microsoft.com/support/kb/articles/Q99/8/06.ASP
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:vvm101
ID: 2655973
I do not understand where CMenu standard procedure must be called.
0
 
LVL 23

Expert Comment

by:chensu
ID: 2656090
In the CCustomControlSite::XDocHostUIHandler::ShowContextMenu function (custsite.cpp).
0
 

Author Comment

by:vvm101
ID: 2656578
Is it possible to create my own context menu directly in CHTMLView, without implementation IDocHostUIHandler ?
0
 
LVL 23

Accepted Solution

by:
chensu earned 200 total points
ID: 2657094
No, you have to implement IDocHostUIHandler. CHTMLView uses the Web Browser control.
0
 

Author Comment

by:vvm101
ID: 2666617
But I am looking for a solution without IDocHostUIHandler implementation.
0
 

Author Comment

by:vvm101
ID: 2684329
If current implementation allows, it is possible to override default menu in CHTMLView-based application using PreTranslateMessage(MSG* pMsg) :

if ( pMsg->message == WM_RBUTTONUP )
{
   POINT pt = pMsg->pt;
   CWnd::ScreenToClient(&pt);
   ShowMyContextMenu(pt);
   return true;
}
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

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

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

824 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