Get notification of user clicking on menu item

  • Thread starter Thread starter Nathan Baker
  • Start date Start date
N

Nathan Baker

Hey all,

I've had to dive down into unmanaged world from .NET recently to
subclass the IE browser window for the purposes of adding menu items.
I've gotten the items added thanks to the Win32 API "InsertMenu" call,
but they don't do anything.

The problem is, I don't own the menu, so I don't process the result
codes that are returned from TrackPopupMenu (or TrackPopupMenuEx). I
don't know if IE uses the IContextMenu mechanism that the Windows
Shell does, but I doubt it. So without having to reimplement the
browser's ShowContextMenu function (which would be a bit of a hack,
most likely), how can I get my menu items to do what I want?

I tried looking for windows messages raised when a menu item is
clicked, but it doesn't look like there are any. I see a
WM_MENUSELECT, and then I see WM_UNINITMENUPOPUP, but nothing to
indicate that the item was actually clicked on.

Is there a (relatively) easy way I can specify a function to be called
when someone clicks on my menu item if I'm not the one calling
TrackPopupMenu?

Thanks,
Nathan
 
Nathan,

Are you doing this for a control that is in your application (meaning
you are hosting the window), or are you doing this to an already existing IE
window?
 
Nathan,

Are you doing this for a control that is in your application (meaning
you are hosting the window), or are you doing this to an already existing IE
window?

Nicholas,

I am doing this in an already existing IE window, which makes it more
complicated.

Thanks for the reply.

Nathan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top