Solved

Context menu in CHTMLView-based application

Posted on 2000-03-24
9
565 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

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 50 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: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

636 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