vvm101
asked on
Context menu in CHTMLView-based application
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.
ASKER
This example explains the way to disable default menu. But I don't understand how to implement my own menu.
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
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
ASKER
I do not understand where CMenu standard procedure must be called.
In the CCustomControlSite::XDocHo stUIHandle r::ShowCon textMenu function (custsite.cpp).
ASKER
Is it possible to create my own context menu directly in CHTMLView, without implementation IDocHostUIHandler ?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
But I am looking for a solution without IDocHostUIHandler implementation.
ASKER
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;
}
if ( pMsg->message == WM_RBUTTONUP )
{
POINT pt = pMsg->pt;
CWnd::ScreenToClient(&pt);
ShowMyContextMenu(pt);
return true;
}
Driller (MFC) Sample
http://msdn.microsoft.com/downloads/c-frame.htm?953938653415#/downloads/samples/internet/browser/driller/default.asp