Re: can event handler call event source passed as connection point parameter?
Now you are jumping to many unfounded conclusions.
I never said anything like that. What I did say is that when
passing a derived interface through a _pure_dispinterface_,
not a COM interface, you get IDispatch* for dual interfaces
and IUnknown* for non-dual interfaces on the other end.
That's all IDispatch::Invoke understands after all, since all
arguments are passed within VARIANTs. A VARIANT can
only contain VT_DISPATCH and VT_UNKNOWN interface
pointers. After marshaling these become IDispatch* and
IUnknown* respectively, with no other methods in the vtables.
--
=====================================
Alexander Nickolov
Microsoft MVP [VC], MCSD
email: agnickolov@mvps.org
MVP VC FAQ: http://www.mvps.org/vcfaq
=====================================
"Xudong" <chenxudongsg@gmail.com> wrote in message
news:1159760963.177851.208880@m7g2000cwm.googlegroups.com...
That means interfaces derived from IDispatch can only be passed as base
IDispatch?!
Is there a way to change that behavior?
Does this happen within apartment where marshaling is not involved?
Also does this happen on IUnknown?
I saw many SDKs defined COM interfaces as function parameters.
Alexander Nickolov wrote:
IServer is only a convenience in the type library and doesn't
happen in practice. What you get is IDispatch*, which after
marshaling is _only_ IDispatch* - no extra methods in the
vtable. You need to QI to get a full-fledged IServer vtable.
--
=====================================
Alexander Nickolov
Microsoft MVP [VC], MCSD
email: agnickolov@mvps.org
MVP VC FAQ: http://www.mvps.org/vcfaq
=====================================
"Xudong" <chenxudongsg@gmail.com> wrote in message
news:1159675552.345730.43370@m73g2000cwd.googlegroups.com...
Sorry, I simplified what I really had and forgot to write that one. The
actual code did have the correct parameters.
I was really curious why it worked by QueryInterface for its own
interface.
Igor Tandetnik wrote:
"Xudong" <chenxudongsg@gmail.com> wrote in message
news:1159520268.297967.79230@i42g2000cwa.googlegroups.com
[id(3)] void OnSomeEvent([in] IServer * ptr, [in] long
param);
So event takes two parameters
void __stdcall OnSomeEvent(IServer * ptr) {
How come there is only one here?
--
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