COM Events and IDispatch - DWebBrowserEvents2 and HTMLWindowEvents2
- From: "Lady_A" <alexandra.lev@xxxxxxxxx>
- Date: 5 Jan 2007 16:09:27 -0800
Hi,
I have an IE plugin that is hooked into DWebBrowserEvents2 in the
following way :
[
...
dual,
...
]
interface IMyInterface : IDispatch {
part of DWebBrowserEvents2 methods with their dispids
};
coclass MyCoClass {
[default] interface IMyInterface;
};
class ATL_NO_VTABLE MyClass: public
CComObjectRootEx<CComObjectThreadModel>,
public CComCoClass<MyClass, &CLSID_MyCoClass>,
....
public IDispatchImpl<IMyInterface, &IID_IMyInterface,
&LIBID_MyLibrary, 1, 0> {
BEGIN_COM_MAP(MyClass)
COM_INTERFACE_ENTRY(IMyInterface)
COM_INTERFACE_ENTRY(IDispatch)
....
COM_INTERFACE_ENTRY_IID(DIID_DWebBrowserEvents2, IDispatch)
....
};
It works fine and now I need to add hooking into
HTMLWindowEvents2::onunload
First of all I am not clear on how can my class can expose in the
COM_MAP an interface DWebBrowserEvents that it does not implement
according to the declaration (it has all the funcs, but there is no ":
public DWebBrowserEvents2")
Second of all, how do I add the HTMLWindowEvents2 in this case ?
Do I just add a COM_INTERFACE_ENTRY_IID(DIID_HTMLWindowEvents2,
IDispatch) and the onunload (to the .idl, .h and .cpp) ? But than I
have 2 interfaces that exposes IDispatch part, although I did not
explicitly say that MyClass implements those, and thats a violation, is
not it ?
And if I am missing something and this is the way to do it than what
about the params of the methods of HTMLWindowEvents - they all use
IHTMLEventObj and not VARIANT/IDispatch, can I use that in the .idl,
should I change it to IDispatch ? Does the signature has to match or
the appropriate dispid of the method declared in HTMLWindowEvents2 is
enough ?
Please help!!!
Thanks!
.
- Follow-Ups:
- Re: COM Events and IDispatch - DWebBrowserEvents2 and HTMLWindowEvents2
- From: Igor Tandetnik
- Re: COM Events and IDispatch - DWebBrowserEvents2 and HTMLWindowEvents2
- Prev by Date: Re: How to have an interface as a member variable
- Next by Date: Re: COM Events and IDispatch - DWebBrowserEvents2 and HTMLWindowEvents2
- Previous by thread: Re: IErrorInfo
- Next by thread: Re: COM Events and IDispatch - DWebBrowserEvents2 and HTMLWindowEvents2
- Index(es):
Relevant Pages
|