Re: Accessing external object from WNDPROG
- From: "Igor Tandetnik" <itandetnik@xxxxxxxx>
- Date: Tue, 12 Jun 2007 08:21:22 -0400
<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
.
- Follow-Ups:
- Re: Accessing external object from WNDPROG
- From: gzching
- Re: Accessing external object from WNDPROG
- References:
- Accessing external object from WNDPROG
- From: gzching
- Accessing external object from WNDPROG
- Prev by Date: Accessing external object from WNDPROG
- Next by Date: loading html from memory with my IMoniker implementation doesn't resolve URLs
- Previous by thread: Accessing external object from WNDPROG
- Next by thread: Re: Accessing external object from WNDPROG
- Index(es):
Relevant Pages
|
|