Re: Howto initialize a private (not registred) interface?
"Jerker" <jerker.back@gmail.com> wrote in message
news:dce3569b-90be-44fe-959a-1dd46f8fc38b@q28g2000prh.googlegroups.com
The second parameter of CComCoClass should be a CLSID,
not an interface IID.
Hm..., I added this to project idl file
[
uuid(29B14D2D-9324-4627-B260-AF49097FC4BA),
helpstring("Callback Class")
]
coclass Callback
{
[default] interface IDiaLoadCallback2;
};
which gives a CLSID_Callback. OK?
Well, if you insist. I don't see why you need a CLSID for your class at
all, but you can certainly have one if you want.
As for the initialize method, I thought since I already got a main
object of type IDiaDataSource, I should use this via IUnknown to
initialize my implemented IDiaLoadCallback2 interface. You both
suggest I should create a new object for IDiaLoadCallback2. I
suspected something like this but it seems wrong somehow.
If you don't create an instance of an object that implements
IDiaLoadCallback2, where else do you expect the implementation to come
from?
In the sample code of DIA SDK they just created a C++ class that
inherit IDiaLoadCallback2 and use Addref() to initialize an instance
of that class.
What do you mean, used AddRef to initialize an instance? First, AddRef
doesn't initialize anything, it just increments reference count. Second,
before you can call AddRef, don't you need to create an instance to call
it _on_ ? You know, something to put on the left side of ->AddRef()
With all due respect, I suggest you invest in a COM textbook. You appear
to be confused about basic concepts.
--
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