Disable Context Menu Item
- From: "Kelly" <kelly.graus@xxxxxxxxxxx>
- Date: 17 Jan 2007 17:01:41 -0800
I am using an IWebBrowser2 control in a C++ program (no MFC) to embed
an IE instance in window. One of the requirements is to be able to
load content from a stream, which breaks the history list in IE (since
it doesn't have a URL). So I've implemented my own back/forward list
that is able to take into account loading content from a stream. This
all works fine.
However, I need to be able to overload the Back and Forward menu items
in the IE context menu. So I've implemented the DocHostUIHandler
interface, read in the correct context menu, called TrackPopupMenu, and
then handled back and forward myself. This also works great, except
that I am unable to enable/disable the Back and Forward menu items to
match the state of the history.
I've also tried deleting the Back and Forward menu items and throwing
my own in there with different IDs (using IDM_MENUEXT_FIRST__). In
this case, the menu items are always enabled.
I've read that I need to capture the WM_INITMENUPOPUP message and
enable/disable them in there. However, the window handle that I'm
passing to TrackMenuPopup doesn't "belong" to me, and my attempt at
subclassing it didn't work (I'm accessing the window handle by doing a
QueryInterface with IID_IOleWindow on the IUnknown pointer being passed
to ShowContextMenu, and then calling GetWindow on the IOleWindow).
Does anyone know how to enable/disable menu items in the context menu,
or how to correctly subclass IE's window so that I can handle the
WM_INITMENUPOPUP message?
Thanks!
.
- Follow-Ups:
- Re: Disable Context Menu Item
- From: Igor Tandetnik
- Re: Disable Context Menu Item
- Prev by Date: Looking for a way to host web browser control in a view from Extension DLL
- Next by Date: Re: Disable Context Menu Item
- Previous by thread: Looking for a way to host web browser control in a view from Extension DLL
- Next by thread: Re: Disable Context Menu Item
- Index(es):
Relevant Pages
|
|