Problem with RegisterActiveObject
Posted on 2008-10-08
I'm trying to get RegisterActiveObject to behave. Doing it the way that's been described here
type TAutoClass = class (TAutoObject,IMyInterface)
Cookie : longint;
procedure Initialize; override;
RegisterActiveObject (Self As IUnknown, Class_MyClass, ActiveObject_Weak, Cookie);
gives two 'incompatible types', IUnknown/TAutoClass and Ole2.TGUID/System.TGUID.
I can make it compile OK by writing
RegisterActiveObject (IUnknown(Self), Ole2.TGUID(Class_MyClass), ActiveObject_Weak, Cookie);
but when I actually use the thing something goes drastically wrong and I'm seeing recursive calls
into the initialize routine, the RegisterActiveObject seems to be causing a new Initialize. What basic
mistake am I making here?