We have an application which is also a COM server and can run either as standalone or automated by a COM client.
The COM Class is declared in the following way:
type
TCommandApp = class(TAutoObject, IConnectionPointContainer, ICommandApp)
And the Initialization part is as follows:
TAutoObjectFactory.Create(ComServer, TCommandApp, Class_CommandApp,
ciSingleInstance, tmApartment);
Which creates an instance of TCommandApp. The question is how do I reference the instance of TCommandApp created by TAutoObjectFactory? (Call its methods etc).
If you want to create
TCommandAppinstances the same way COM does, then you should call the factory’sCreateInstancemethod, which comes from theIClassFactoryinterface.Alternatively, you can call the constructor directly: