The SvCom components set has a special service module
to be used as a parent of COM-supporting services. The service that
contains one or more DCOM servers should perform some additional work.
It should register and unregister COM objects in registry, it should
register their classfactories at starting and revoke them before stopping.
The special service module - TComService- does all this work for you.
All that you have to do is to add TComService module to project and
set its properties.
Go to the File|New dialog and select the SvCom page
Select the "Service with DCOM server" item from the list
and press OK. The new ComService module will be created. Change its
name to ComServiceModule and save the unit as svcComServiceModule.pas.
The only line of code to modified in this module is to add CoInitializeSecurity
call. This line disables any COM security checks, we use it to simplify
configuration of our example. In other case you would need to do some
additional operations before test the example. The CoInitializeSecurity
method is declared in the ActiveX unit, don't forget to add it to the
Uses clause.
|
initialization
CoInitialize(nil);
CoInitializeSecurity (nil, -1, nil, nil, 1, 1, nil, 0, nil);
finalization
CoUninitialize;
end.
|
Now proceed to the next
step to create the server object itself.