Constructors and Destructors in Automation objects
Is it possible to have a constructor and destructor in an Automation object?
I need my server to keep track of how many objects are created by outside
clients. In a Visual Basic version I did this by incrementing or
decrementing in the Class_Initialize and Class_Terminate events that occur
whenever an object is created. I thought this would be even easier in
Delphi. I could just give the class of the object a constructor and
destructor and count there. Unfortunately this doesn't work and I don't see
an alternative.
When I try to create a constructor that overrides the default constructor
inherited from TAutoObject, I get an error saying that you can't override a
static method. I tried creating the constructor anyway without override.
Delphi lets me do this, but it doesn't seem to generate any code for the
constructor. The code I put in the constructor is never executed.
If there can be no constructor in an Automation class, does anybody know of
any other way for the server to monitor how many objects have been created?
Specifically I need to know when there are no remaining objects.
Bruce McKinney