Re: Events from the WebBrowser control
- From: "Igor Tandetnik" <itandetnik@xxxxxxxx>
- Date: Wed, 14 Feb 2007 21:55:12 -0500
"Norman Bullen" <norm@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote in
message news:r3PAh.2273$tD2.699@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
The MSDN documentation for DWebBrowserEvents2 says that it derives
indirectly from IDispatch and shows members such as BeforeNavigate2
and NavigateComplete2.
It doesn't derive from IDispatch - it _is_ IDispatch. It's a so called
dispinterface. A dispinterface is IDispatch plus the description of
which DISPIDs are valid, what they mean and which parameters should
accompany each.
Thus, BeforeNavigate2 is not a method in COM interface sense - it
doesn't correspond to a vtable entry. Calling this "method" means
calling IDispatch::Invoke with a dispid of DISPID_BEFORENAVIGATE2 and a
particular set of parameters in DISPPARAMS structure.
I have some sample code that compares at the DISPID_xxx names
associated with the dispinterface functions with the dispIdMember
argument that is passed to DWebBrowserEvents2::Invoke().
Is this the best/only way to handle these events in C++?
Not if you are willing to use libraries designed to help one write COM
code. E.g. ATL provides IDispEventImpl class specifically to implement
event sinks that are dispinterfaces (the most common kind). See
ATLBrowser sample.
--
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: Events from the WebBrowser control
- From: Norman Bullen
- Re: Events from the WebBrowser control
- References:
- Events from the WebBrowser control
- From: Norman Bullen
- Events from the WebBrowser control
- Prev by Date: Events from the WebBrowser control
- Next by Date: Re: Events from the WebBrowser control
- Previous by thread: Events from the WebBrowser control
- Next by thread: Re: Events from the WebBrowser control
- Index(es):
Relevant Pages
|
|