Re: IWebBrowser2 and html document with frames.

Tech-Archive recommends: Speed Up your PC by fixing your registry



"Chimanrao" <chimanrao@xxxxxxxxx> wrote in message
news:1127057126.968767.32900@xxxxxxxxxxxxxxxxxxxxxxxxxxxx
> Does this mean that I need to create a separate object to sink the
> event each time DocumentComplete event gets called?

In theory, you can have the same sink handle events from multiple
documents. In practice, it makes it difficult to find out which document
an event is coming from. It is usually wise to indeed have a separate
sink object for each document (of course they can all be instances of
the same class).

> Does the DispEventAdvise call increase the ref count on my object i.e.
> let say I navigate from one page with 3 frames to another page with 3
> frames, the objects that I used to the first time to sink the events
> do they get managed automatically thru the the AddRef, Release
> mechanism?

When you advise, your sink is AddRef'ed (the source stores an interface
pointer to it). When a page is navigated away from, you should
explicitly unadvise your sinks and release all references you might have
held on the document and/or its elements. Otherwise the document object
will hang around in memory, and you'll get huge memory leaks. See here
for the scheme I suggest:

http://groups.google.com/group/microsoft.public.inetsdk.programming.webbrowser_ctl/msg/acf00eb05dbf0237

> Do we get a separate IWebBrowser2 object for each frame?

Yes you do.

> How different
> is it from the IWebBrowser2 object obtained in SetSite?

It's a distinct pointer to a distinct instance. Other than that, it has
all the same properties and methods. I guess I don't quite understand
this question.

> If these things are documented somewhere, can you point me to the
> link? I looked up on MSDN, but could not find it

I don't believe they are exactly laid out in one place somewhere. One
could gather this information in bits and pieces here and there. I
consider myself something of a collector of IE programming trivia. A
hobby, if you will.
--
With best wishes,
Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925


.



Relevant Pages

  • Re: IWebBrowser2 and html document with frames.
    ... Does this mean that I need to create a separate object to sink the ... event each time DocumentComplete event gets called? ... frames, the objects that I used to the first time to sink the events do ...
    (microsoft.public.inetsdk.programming.webbrowser_ctl)
  • Re: Kitchen sink types
    ... I was going to get a new sink with one large section and one small section, then thought it might be good to just have one giant sink without a partition at all. ... Is there another common purpose for having a split sink other than to have soapy water and rinse water separation for hand washing? ... I really think that eventually double basin sinks in kitchens will go the way of the dinosaur. ... If you ever needed a separate basin, you could just keep a little ...
    (alt.home.repair)
  • Re: Erik Prusch
    ... CodeGear will have a separate everything. ... One can only hope that if you keep repeating this ... it will eventually sink in. ... Keep pressin' ...
    (borland.public.delphi.non-technical)
  • Re: UnExplained ATLASSERT by IDispEventImpl::DispEventAdvise/UnAdvise
    ... IDispatchImpl and IDispEventImpl. ... However, If I have HTML with multiple frames, and I attempt to sink ... You can't advise the same sink to multiple sources. ...
    (microsoft.public.vc.atl)
  • When Is Page Rendering Complete?
    ... frames, has fully loaded. ... an event I can sink that fires when the entire page rendering is complete? ... Mike ...
    (microsoft.public.inetsdk.programming.webbrowser_ctl)