The COM-object of this example will have two important
features. First of all we'll generate the singletone factory for it.
We do it to allow one instance of the object to be created only. This
single instance will handle all client requests and it will broadcast
service events to all clients if ncessary.
The second feature is the event-supporting code to
be generated. This code will allow clients to register their callback
interfaces. It is these interfaces will be used by server to communicate
Do the following to create a new COM-object with features
mentioned above. Open the File | New dialog and run the "Automation
Object in Service" wizard from SvCom tab. Select options as shown
Press OK - the new unit with COM-object implementation
will be created. Save it as clsComObjectWithEvents.pas
Now take a look on project's typelibrary:
As you can see there are on co-class and two interfaces
- one is a regular interface and the second one is a dispinterface.
It is this second dispinterface will be used later in the example as
a client's callback. Note that while this interface is declared by server
it is the client is responcible for implementation of this interface.
The next step to be done is to add properties and methods
to interfaces. Let's continue...