Re: Accessing external object from WNDPROG
- From: "Igor Tandetnik" <itandetnik@xxxxxxxx>
- Date: Wed, 13 Jun 2007 21:53:30 -0400
<gzching@xxxxxxxxx> wrote in message
news:1181784115.807271.166080@xxxxxxxxxxxxxxxxxxxxxxxxxxxx
One thing I found during the experience is that WNDPROC was running in
a thread different from the one in which the browser helper object is
created.
Ah. Are you using IE7, by any chance? In IE7, each tab's WebBrowser runs
in its own thread, and the main window runs in yet another thread. Each
tab creates its own, separate instance of each BHO. You would have to
marshal JavaScript-provided pointer to the main window's thread before
you could call a method on it. Or else, have the BHO create a hidden
window in its tab's thread, and have the window proc send a message to
this window, thus effectively marshalling the notification to the tab's
thread.
This makes me think of marshalling issue. But I have no
problem to invoke a property on my external object, such as "hr =
pDispExternal.GetProperty(DISPID_ONCLOSE, &varOnClose); ".
Your object doesn't mind being misused (but you potentially have a race
condition). Script engine checks for such misuse and complains.
hr = pDispExternal.GetProperty(DISPID_ONCLOSEMONIKER,
&varOnClose);
How do you obtain pDispExternal? At that point, you are already
violating COM threading rules.
--
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
.
- Follow-Ups:
- Re: Accessing external object from WNDPROG
- From: gzching
- Re: Accessing external object from WNDPROG
- References:
- Accessing external object from WNDPROG
- From: gzching
- Re: Accessing external object from WNDPROG
- From: Igor Tandetnik
- Re: Accessing external object from WNDPROG
- From: gzching
- Re: Accessing external object from WNDPROG
- From: Igor Tandetnik
- Re: Accessing external object from WNDPROG
- From: gzching
- Accessing external object from WNDPROG
- Prev by Date: Re: Accessing external object from WNDPROG
- Next by Date: Re: Reload detection
- Previous by thread: Re: Accessing external object from WNDPROG
- Next by thread: Re: Accessing external object from WNDPROG
- Index(es):
Relevant Pages
|
|