Disable Context Menu Item



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!

.



Relevant Pages

  • Re: Why cant I see static variables in debug window
    ... Auto pane of the variable window, because you're about to use it (to add ... you can use the Locals pane to see everything... ... if you're *using* the static in the context where you ... Variables debug window, the value of the variable x does not show. ...
    (microsoft.public.windowsce.embedded)
  • Re: Avoiding shell window popup on cygwin xemacs
    ... it pops up an annoying empty shell window. ... > necessary under xemacs. ... context in Usenet posts. ... that the high-volume poster thinks needs clarification. ...
    (comp.emacs.xemacs)
  • RE: debugger IDE hangs when stepping with properties in watch wind
    ... Thanks - but as I'm typically changing context with each step (from one ... adding and then removing items from the watch ... window before each step isn't really very helpful - basically, ... > watch window, it will cost debugger much time to resolve these variables, ...
    (microsoft.public.vsnet.debugging)
  • Re: How can I get mouse shortcuts to work in Excel
    ... The Intermediate window is from the Visual Basic Editor. ... There is no right click menu (context menu missing). ... > Hi Dave, Thanks for the response. ...
    (microsoft.public.excel.setup)
  • Re: Context menus
    ... and you'll get the HWND of the menu window (maybe there ... > I am trying to simulate a click on a right-click context menu. ... > HMENU that is coming in with that message and all is right with the world. ... > But there are some context menus that don't generate these messages and I ...
    (microsoft.public.win32.programmer.ui)