Click to See Complete Forum and Search --> : ICustomDoc implementation
luxius
Aug 3rd, 2003, 02:35 PM
I want to implement ICustomDoc (and related interfaces IDocHostUIHandler) from inside my project.
The only working way is to link olelib.tlb (Edanmo) but I prefer to make all work inside my project.
Why MSHTML.tlb doesn't expose ICustomDoc???
In effect it's possible in C++ with QueryInterface of HTMLDocument!!!
*** IS IT POSSIBLE TO USE QueryInterface directly from VB??? ***
Thank You all!!!
vibin_nair
Aug 4th, 2003, 05:32 AM
Hi,
I hope you want to use a webbrowser control and control its behaviour from within your project , If Yes, then this is what you can do in order to implement IDocHostUIHandler from within your project.. do the following:
1> Inherit a class from IDocHostUHandler... say
CMyIDocHostUHandler.
2> Now IDocHostUIHandler has 15 pure virtual functions . All
these pure virtual function needs to be overriden by us.
3> In order to refer to these pure virtual functions exposed
by IDocHostUIHandler just refer to MSDN.
4> Now if you are using a webBrowser control then in the
navigate complete event of the webbrowser control create
the instance of the inherited class i.e CIDocHostUHandler.
5> Now get the document pointer of the webbrowser control
by calling "get_document" function on IWebBrowser2
interface of the webbrowser.This pointer is basically an
IDispatch pointer.
6> Once this IDispatch pointer is obtained, get ICustomDoc
interface from IDispatch.
7> On obtaining the ICustomDoc interface, call the
SetUIHandler function , and pass the address of
CMyIDocHostUHandler instance as parameter.
8> On doing so the Web Browser will call methods on the
interface and behave according to how the host
implemented the interface.
Hope this suffices your need.
- vibin
luxius
Aug 4th, 2003, 12:05 PM
Hi vibin_nair!!!
OK... this is the C++ like implementation!!!
Is it someway possible to do it directly from VB???
My problem is that ICustomDoc is not exposed by any TypeLib...
I only find a tlb from Edanmo (http://www.mvps.org/emorcillo/download/typelibs/tl_ole.zip) which make all the work but I would like to make it without linking to that tlb!!!
My BIG problem is that I prefer to understand what I'm using or doing and evntually make it from myself!!!
dzzie
Aug 7th, 2003, 11:04 AM
the only way I have seen to do this is to use a typelib to
define the interfaces
I think by using a typelib and implementing a defined
interface with its defined GUID that that GUID will be used
on your interface as well
in vb classes I know of no way to control the direct guids
the classes support
mabey this is not a 100% requirement I am not sure, mabey
just implementing the functions is enough but I have a feeling
the host app will query the classes IUnknown for the GUID to locate Idocuihandler ?
if you dont want to use edmundos entire tlb, go through the idl and just pull out the interfaces you need and try to compile them into a custom made tlb that has only what you need
it is a good learning thing anyway but alot of hunting to find all the included intrerfaces and get the idl all straight again.
in either case, you do not have to distribute the tlb with your final app or register it on the client systems
the tlb is only needed by you to compile the project
dzzie
Aug 7th, 2003, 11:10 AM
or...
mabey define the interface in a vb class say clsIDocHostUiHandler
no implementation, just prototypes
then in your class
implements clsIDocHostUiHandler
then compile w/ binary compatability (as ocx or dll)
go in with a tlb editor such as one from here
http://powervb.com
change teh guid on the clsIDocHostUiHandler to be that of the
defined IDocHostUIHandler
then your implemenatation class from then on should
think that it is suooprting the right interface with right GUID?
more work and not as safe as tlb file if your compatability settings
ever slip..mabey not even work, just idea
anyone? bueller? bueller?
alexandros
Sep 6th, 2003, 07:59 AM
is it possible to tweak the webbrowser control so that it
has source code preservation ? This means that it will not change
all tags to uppercase in its .document and does not cut empty spaces.
I want to make a webpage editor.
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.