Thanks for your help. Sorry about such a long post, but I didn't know
how to respond to it, so I copied and pasted it.
---------start of old original post---------
I assume you have some JavaScript (or other script language) code on
the
page in the browser, some script code on the page loaded into the bar,
and you want them to be able to communicate with each other. Here's
one
of the possible solutions.
When instantiated, explorer bar receives IWebBrowser2 pointer of the
hosting browser (well, indirecly: if you don't know how to get such a
pointer, ask me). Sink events from this interface. Handle
NavigateComplete2 event - that's the earliest point where DHTML
document
and window objects are available for a page that is being loaded. Get
to
the window object - call IWebBrowser2::get_Document, QI the pointer
for
IHTMLDocument2 and call get_parentWindow.
Now you know how to obtain an interface pointer of window object for
each page loading into the browser. To let the script on the main page
communicate with your bar, follow these steps. QI window object for
IDispatchEx. Call IDispatchEx::GetDispID with some long name (to avoid
conflicts) known to your script, and fdexNameEnsure flag. This will
create a new property on the window object and give you the DISPID of
this property. Use IDispatch::Invoke or IDispatchEx::InvokeEx to set
the
value of this property. E.g. you can set it to an IDispatch of the
window object hosted inside your explorer bar, or to the object
implemented by the bar itself.
To let the script inside the bar talk to the script on the page,
follow
these steps. Implement IDocHostUIHandler in your bar, in particular
GetExternal method. You can return arbitrary automation object from
GetExternal. The script obtains this object via window.external
property. It may be the window object in the main window, or the
object
implemented by the bar itself that, say, has a property referring to
the
main window object.
--
With best wishes,
Igor Tandetnik
"For every complex problem, there is a solution that is simple, neat,
and wrong." H.L. Mencken
"Joga Singh" <jo...@gr8ventures.com> wrote in message
news:OnpFH3w9BHA.2220@tkmsftngp03...
> Hi,
> I have a Explorer Bar created using the registry entries. How can I refer to
> this bar from the main window and similarly how can I refer to the main
> window from this bar? I am showing a HTML page in the bar.
>
>
> Regards:
>
> JS
>
>
>
"For every complex problem, there is a solution that is simple, neat,
and wrong." H.L. Mencken
"mweiss" <mwhi...@hotmail.com> wrote in message
news:b64bf032.03040...@posting.google.com...
Now I have another question :-) To sink the
NavigationComplete2 event, I have to implement the
DWebBrowserEvents2 Interface, right? Only most of my
events would be E_NOTIMPL because they don't apply to the
explorer bar. Where do I implement this? Since the
events don't return HRESULTs I don't know that I'd
implement it on my explorer bar because it's a COM
object. I'm still not sure how to show the HTML page in
the window, but maybe that's where I'd implement it.
Sorry for all the questions, but this is new territory for
me. I appreciate your help.
Thanks.
Melinda
>.
>
Right.
> Only most of my
> events would be E_NOTIMPL because they don't apply to the
> explorer bar.
Events don't return an HRESULT. You just do nothing in the handler for
the event you are not interested in.
> Where do I implement this?
Anywhere, on any object that's convenient. It may be your main explorer
bar object or a dedicated sink object, or whatever.
> Since the
> events don't return HRESULTs I don't know that I'd
> implement it on my explorer bar because it's a COM
> object.
I don't understand this at all. So what if they don't return HRESULT?
With all due respect, a COM primer seems to be in order. "Inside COM" by
Dale Rogerson is often recommended.
>.
>
Thanks.
Melinda
>.
>