I would to change the menuitems in the default context menu provided in the Web Browser Control. I have already tried: webbrowser.contextmenu = mycontextmenu. Nothing changed. Is there a way to do this?
views:
1085answers:
3I'm trying to do the same thing. I read about 5 codeproject articles (they kind of old by the way) but couldn't get the COM interop part right. Probably because I can't program in C++.
But then I found this page http://www.pinvoke.net/default.aspx/Interfaces/IDocHostUIHandler.html which seems promising. It contains a c# interface that claims to provide the functionality you want. However I still couldn't make it work all the way, so I'd appreciate if somebody else could contribute to this answer.
Since I don't know how much you are familiar with c# (I'm pretty much a noob by the way), I'll post some extra steps here, using VS2008. Add the Microsoft.mshtml as reference to your project, create a new c# interface, and on top of the interface add the extra 3 "using" statements.
using System.Windows;
using System.Runtime.InteropServices;
using mshtml;
And paste the code of the interface definition. Then make the WebBrowser container implement this interface and all the methods. This is how far I got 'till now. I'm still looking for a way to redirect the browser events to the container.