Products:

- SvCom
- Shell+
- PerfUtils

Download:

- SvCom
- Shell+
- PerfUtils

Ordering:

- Order now
- Resellers

Support:

- Contact directly


Embarcadero Technology Partner

 
    Step 6. Use service application as a regular one  

Starting from SvCom 6.0 version SvCom-based amplification can auto-detect whether it was started as a service by Service Control Manager, as a service installation or controlling tool (switches /install, /uninstall, /start and other) or as a regular application. In the last case SvCom-based application can behave as a regular application with forms - it shows the main form, runs dialogs and so on. All you need to implement this behavior is to create a main application form:













 
 

 


 
 
 
 
 

program SvComExample2;

uses
  Forms,
  Dialogs,
  SvCom_NTService,
  svcExample2 {SampleService2: TNtService},
  fmExample2 {RegularMainForm};

{$R *.RES}

begin
  Application.Initialize;
  // The service module will be used when app is started as a service
  Application.CreateForm(TSampleService2, SampleService2);
  // The form will be used as a regular application main form
  // if the application is started as a regular one.
  Application.CreateForm(TRegularMainForm, RegularMainForm);
  // The line below is necessary for SvCom versions older than 6.0.44.77
  Forms.Application.ShowMainForm := True;
  Application.Run;
end.

The only important thing to care about is that the Forms unit should be placed before than SvCom_NtService unit in the uses clause. The reason is that both units contain Application variable and compiler will use the last mentioned by default. For service application the SvCom_NtService.Application should be used so SvCom_NtService should be placed after Forms in the uses clause.

<< . index . 1 . 2 . 3 . 4 . 5 . 6 . >>
SvCom links:

- Overview
- Download
- Purchase
- FAQ
- Tutorial
- What's new
- For registered users
- Support

Copyright:

© 1998-2003. Alexey Dynnikov
© 2003-2016. ALDYN Software
© Design: Adonis i-cafe.