Re: Accessing external object from WNDPROG



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

.



Relevant Pages

  • Re: Accessing external object from WNDPROG
    ... a thread different from the one in which the browser helper object is ... Are you using IE7, by any chance? ... and the main window runs in yet another thread. ... This makes me think of marshalling issue. ...
    (microsoft.public.inetsdk.programming.webbrowser_ctl)
  • Re: Missing history in IE7
    ... the same window. ... IE7 in No Add-ons mode: ... Right-click on the blue IE desktop icon and select Start without Add-ons; ... History was being recorded. ...
    (microsoft.public.windows.inetexplorer.ie6.browser)
  • Re: Mail merge data form problem after installing IE7
    ... I can view that form on top of a IE7 Web Page. ... clicking on the Word icon from the taskbar shows this as the active window ... As the dialog box (data form) is from the same Word session, ... not just the top level data form. ...
    (microsoft.public.word.mailmerge.fields)
  • Re: Internet Explorer 6 CSS "expression" Denial of Service Exploit (P.o.C.)
    ... so I apologize to the second poster who tested it on IE7 ... it opens a new instance of itself in a new window? ... "it works on blahblah with SPblahblah" ...
    (Bugtraq)
  • Re: about:blank problem
    ... When hitting an URL from an email message, Firefox opens the ... window but two seconds later, IE7 opens an about:blank window. ...
    (microsoft.public.windowsxp.help_and_support)