Hi GoldTree,
Regarding on this issue, I noticed that you've posted a similar BHO thread
recent days, I've replied you with some info about customizing context
menu, here is my reply in that thread:
#BHO & context menu customization
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1159435&SiteID=1
Also, I've performed some further research, here is some other information
found so far:
========================
For all IE versions up to IE6.0, the best we can do is replace the context
menu by sinking document events, cancellling the oncontextmenu event and
drawing our own context menu. The CreateMenu(), Append/InsertMenuItem() and
TrackPopupMenu() Win32 API calls are required to do this from C++.
One can override the context menu and display a custom one by implementing
IDocHostUIHandler interface in the host application. One problem is that
even if you build the same menu as IE's, there are no CMDID's to invoke
default implementation of IE for all of those commands using
IOleCommandTarget.
1. With IE 4.x one can subclass IE's window(one customer did this in
IDocHostUIHandler::OnContextMenu) and watch for the WM_INITPOPUPMENU
message and wait for the WM_COMMAND message sent when the user selects a
menu item. But with IE 5 onwards, IE calls TrackPopupMenu, gets the command
ID of the item selected and invokes the appropriate functionality using
IOleCommandTarget without generating a WM_COMMAND message. So developers
can no longer rely on this technique from IE 5 onwards.
2. On some occasions, developers may be doing this to prevent the user from
invoking certain menu items (eg: View Source) In this case, it's easier to
disable the menu item. Subclass the webbrowser control window, watch for
WM_INITPOPUPMENU. You will get the HMenu from this which you can
use to go disable/grey out items using the EnableMenuItem or
SetMenuItemInfo methods. Remember to return 0 after processing this message.
* Note that there is still no way to prevent script on the page from
invoking the same commands.
* For menu items that have accelerator keys, you can watch for these
keystrokes in IDocHostUIHandler::TranslateAccelerator.
Some customers tried to watch for WM_MENUSELECT messages and figure out the
last one moused over to determine which was selected. Since there are a lot
of scenarios that will need to be taken care of eg: user dismiised the menu
by clicking outside the context menu, pressed escape or selected using
mouse or keyboard, strongly advise them against using this technique
==================================
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
is this a new problem or also the same one with that?
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
>From: <GoldTree@nospam.nospam>
>Subject: How to handle document events for the WebBrowser control
[quoted text clipped - 60 lines]
>
>GoldTree
GoldTree@home.com - 05 Mar 2008 17:31 GMT
Hi Steven,
Thanks for your reponse.
1. I like to do this in C#.
2. What is the problem with my code? Why is the other event becomes dead?
(My code follows MSDN KB312777.)
3 There were some post reported this. There seems to be a solution in this
thread:
http://groups.google.com/group/microsoft.public.dotnet.framework.clr/browse_thre
ad/thread/29c030d6faeca214/1d5d8345ef3d7039?hl=en&lnk=st&q=event+mouse+dead+#1d5
d8345ef3d7039
But I do not get the full picture of the solution.
4. There is a solution suggested at this link
http://www.experts-exchange.com/Programming/Languages/C_Sharp/Q_20661377.html
(scroll to the bottom) Is this a recommended solution?
5. I read the link you provided. But there is one comment that "The drawback
is, that only one extension at the time can do this trick."
Regards,
GoldTree
> Hi GoldTree,
>
[quoted text clipped - 128 lines]
> >
> >GoldTree
Steven Cheng - 10 Mar 2008 05:33 GMT
Hi GoldTree,
Thanks for your reply.
Regarding on the further description, I've performed some reseach and so
far haven't found any new info. I'm planning find some other resources to
help you on this issue. Would you send me a mail via the following address?
"stcheng"+"@"+"microsoft.com"
Best regards,
Steven Cheng
Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we
can improve the support we provide to you. Please feel free to let my
manager know what you think of
the level of service provided. You can send feedback directly to my manager
at: msdnmg@microsoft.com.
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
>From: =?Utf-8?B?R29sZFRyZWVAaG9tZS5jb20=?=
<GoldTreehomecom@discussions.microsoft.com>
>References: <O#c8RDZfIHA.4144@TK2MSFTNGP05.phx.gbl>
<H76OKddfIHA.6844@TK2MSFTNGHUB02.phx.gbl>
>Subject: RE: How to handle document events for the WebBrowser control
>Date: Wed, 5 Mar 2008 09:31:02 -0800
>Hi Steven,
>
[quoted text clipped - 7 lines]
>3 There were some post reported this. There seems to be a solution in this
>thread:
http://groups.google.com/group/microsoft.public.dotnet.framework.clr/browse_
thread/thread/29c030d6faeca214/1d5d8345ef3d7039?hl=en&lnk=st&q=event+mouse+d
ead+#1d5d8345ef3d7039
>But I do not get the full picture of the solution.
>
[quoted text clipped - 144 lines]
>> >
>> >GoldTree