
VB and Web Browser Advanced Interfaces (was IDocHostUIHandler in VB)
I didn't have chance with my previous question : no answers ! (is it due to
my poor english ? :-)
Seriously: did anybody see my previous question ?
Anyway, I try again.
Is it possible to host the web browser AX control on a VB form (or an AX
control) and have a complete control over it by implementing the MSHTML
advanced interfaces (IDocHostUIHandler, ICustomDoc, IDocHostShowUI) ?
Does anybody have already done this ? Is it possible using only VB or does
it require a C wrapper class (like WBCustomize.dll) ?
Here is what I have tried:
- I have made a typelib for IDocHostUIHandler and ICustomDoc (not very sure
of the results, I never use IDL before...).
- In VB, I have a form (which host the webbrowser control) and which
Implements IDocHostUIHandler and relatives subs.
- In WebBrowser1.DocumentComplete, I make an association between the
document and my interface :
dim Doc as ICustomDoc
set Doc=WebBrowser1.Document
Doc.SetUIHandler Me
It seems to work : I can control the context menus, I can implements
"window.external" in a script and so on.
BUT :
- i get random GPF in VB
- i have to make the association each time a new document is loaded in the
browser
- some subs of the interface are never called (GetHostInfo or
GetOptionKeyPath, for example).
I think that it would be better if the association between the webbrowser
control and my interface was made only once, during the initialization, but
I don't know how to achieve this...
In MS doc, it is said that the webbrowser control will QueryInterface the
Host's client site. What does it mean in VB ?
Thanks for any help,
Daniel