Re: Accessing external object from WNDPROG
- From: gzching@xxxxxxxxx
- Date: Thu, 14 Jun 2007 22:29:22 -0700
On Jun 14, 11:53 am, "Igor Tandetnik" <itandet...@xxxxxxxx> wrote:
<gzch...@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
I finally had it work. I use marshalling. Thank for the advice.
Yuqing
.
- 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
- Re: Accessing external object from WNDPROG
- From: Igor Tandetnik
- Accessing external object from WNDPROG
- Prev by Date: Re: OnScroll for Webbrowser control in VB
- Next by Date: Re: OnScroll for Webbrowser control in VB
- Previous by thread: Re: Accessing external object from WNDPROG
- Next by thread: loading html from memory with my IMoniker implementation doesn't resolve URLs
- Index(es):
Relevant Pages
|
|