Solved

Context menu in CHTMLView-based application

Posted on 2000-03-24
9
553 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
 

Author Comment

by:vvm101
ID: 2655973
I do not understand where CMenu standard procedure must be called.
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
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 viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
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.

747 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now