Results 1 to 6 of 6

Thread: ICustomDoc implementation

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2003
    Location
    Italy
    Posts
    3

    Lightbulb ICustomDoc implementation

    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!!!

  2. #2
    New Member
    Join Date
    Jul 2003
    Posts
    7

    Implementing IDocHostUIHandler

    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
    Vibin.B.Nair

  3. #3

    Thread Starter
    New Member
    Join Date
    Aug 2003
    Location
    Italy
    Posts
    3

    ICustomDoc implementation

    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/downlo...ibs/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!!!

  4. #4
    Addicted Member
    Join Date
    Feb 2003
    Posts
    237
    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
    Free Code, papers, tools, and more

    http://sandsprite.com

  5. #5
    Addicted Member
    Join Date
    Feb 2003
    Posts
    237
    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?
    Free Code, papers, tools, and more

    http://sandsprite.com

  6. #6
    Fanatic Member alexandros's Avatar
    Join Date
    Oct 2002
    Location
    Milky Way Galaxy
    Posts
    694
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width