Re: Accessing external object from WNDPROG



<gzching@xxxxxxxxx> wrote in message
news:1181623372.507705.299760@xxxxxxxxxxxxxxxxxxxxxxxxxxxx
I'm trying to make a browser helper object which can give javascript
some control over the closing of the browser window. The approach is
described as below:

1. Subclass the browser window (IWebBrowser::get_HWND) with my own
wndproc.

2. Exposes an IDispatch object to the javascript through
window.external. The IDispatch object has a property named "onclose".
The javascript will assign a function object to the "onclose"
property.

3. When a WM_SYSCOMMAND with wParam set to SC_CLOSE comes, I invoke
the javascript' "onclose" function and decide whether to close the
browser window or not.

Unfortunatlely, my implementation of this approach didn't work, the
javascript function was never called. The code ran fine (HRESULT
returned S_OK) until the Invoke call to the "onclose" javascript
function object, where HRESULT came back with E_UNEXPECTED.

Show how you call the function.

My question: Is this approach correct?

I don't see anything immediately wrong with it.
--
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

  • Accessing external object from WNDPROG
    ... I'm trying to make a browser helper object which can give javascript ... Subclass the browser window with my own ... The javascript will assign a function object to the "onclose" ... where HRESULT came back with E_UNEXPECTED. ...
    (microsoft.public.inetsdk.programming.webbrowser_ctl)
  • Re: Accessing external object from WNDPROG
    ... some control over the closing of the browser window. ... The IDispatch object has a property named "onclose". ... The javascript will assign a function object to the "onclose" ... WNDPROC. ...
    (microsoft.public.inetsdk.programming.webbrowser_ctl)
  • Re: How can I permanently delete "links" from appearing on my IE6?
    ... instance only - that particular browser window. ... The next time I click a javascript link, ... pages I get the first several Favorites subfolders appearing in its ... In the case of Zone Alarm 6.5 or Norton 2007 it actually has to be uninstalled. ...
    (microsoft.public.windows.inetexplorer.ie6.browser)
  • Re: Group Questionnaire for Usenet users
    ... I thought, though, that my browser window had been resized on earlier versions. ... so the survey has served one useful purpose. ... Javascript disabled. ... Unfortunately too many web sites these days insist ...
    (alt.usage.english)
  • Re: AKICIF: Multiscreen CGI program question
    ... >> communication in Javascript, etc - I'd like to know about it. ... >Another option is to use a lot of DHTML to do things in a single window, ... >loses all their state if they close their browser window, crash, etc. ... both the above approaches will make Keith Lynch sad. ...
    (rec.arts.sf.fandom)