Re: Is there a way to implement pure IDispatch interfaces in C++?
"raj" <rajayyala@gmail.com> wrote in message
news:1159402417.964553.53740@m73g2000cwd.googlegroups.com
1) How does VB implement reference counting?
The same way as any other COM client, by calling AddRef and Release on
your interfaces.
2) Why didnt com complain when the VB app has a Release method on it?
Why do you think it should have?
3) Does it mean that all VB COM objects are pure IDispatch?
By "VB COM objects", do you mean COM objects implemented in VB, or COM
objects usable from VB? The answer is "no" in either case. VB can both
call and implement dispinterfaces, dual interfaces and custom
automation-compatible interfaces.
I fail to see how this has anything to do with reference counting
though.
4) Last but most important is - how can I get around this issue?
What issue? What exactly seems to be the problem? The only complain you
have is that VB program calls Release on your interfaces - but it's
supposed to do that once it's done with the object.
Is
there a way for me to "hack" and have a release funciton on my
interface ( all my interfaces are Dual interfaces)?
You don't need to "hack" anything: every COM interface is derived from
IUnknown and has three methods specified by IUnknown: QueryInterface,
AddRef and Release. With all due respect, I suggest it may be time for
you to revisit your favorite COM textbook.
Is there a way to implement pure IDispatch interfaces in C++?
Yes. As with any other interface, just derive from it and implement its
methods. I don't quite see how this would help you with the issue at
hand: what makes you think reference counting is any different for a
dispinterface than it is for a dual interface?
--
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