`WebBrowserShortcutsEnabled = false` ignorado cuando se implementa IOLE SetClientSite
false in order to disable typical Internet Explorer shortcuts in my
System.Windows.Forms.WebBrowser implementation. This works fine until I also implement
IOLEClientSite y llamar al
SetClientSite usando el siguiente código:
IOLEObject o = (IOLEObject)this.ActiveXInstance; o.SetClientSite(this);
If I remove this code, it works and shortcuts are properly disabled. What's going on here?
preguntado el 04 de marzo de 14 a las 13:03
WebBrowser is an ActiveX control. It negotiates with its host to deal with UI implementation details like shortcut keystrokes. It needs to tell the host about it first since the host may want to use the shortcut for its own use.
The normal host is implemented by the internal WebBrowserSite class, derived from WebBrowserSiteBase. You replaced it, now it is your job to implement that negotiation. This is done by IDocHostUIHandler::TranslateAccelerator(), simply return S_OK from your implementation of this method. Which tells the browser that it should not process the keystroke itself.
When you override the base functionality of
WebBrowser OLE site object, you're at risk of breaking some existing features. You should consult with .NET reference source code para
WebBrowser implementation details which might be affected by your custom site.
Ideally, you should be calling the base site implementation when you override any COM interfaces, which might be tricky, because the most of COM interfaces implemented by .NET are declared as
No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas c# webbrowser-control ole or haz tu propia pregunta.