BSOne.SFC/eCrmHE/EXE_bootone/eCrmHeService.dpr

55 lines
1.4 KiB
Plaintext

program eCrmHeService;
uses
Vcl.SvcMgr,
Tocsg.Safe,
Tocsg.Win32,
{$IFDEF DEBUG}
Tocsg.Trace,
Tocsg.Path,
{$ENDIF}
SeCrmHeMain in 'SeCrmHeMain.pas' {SvcCrmHe: TService},
GlobalDefine in '..\LIB_Common\GlobalDefine.pas';
{$R *.RES}
var
mtx: TTgMutex;
{$IFDEF DEBUG}
trace: TTgTrace;
{$ENDIF}
begin
Guard(mtx, TTgMutex.Create(MUTEX_SERVICE));
if mtx.MutexState <> msCreateOk then
exit;
{$IFDEF DEBUG}
Guard(trace, TTgTrace.Create(GetRunExePathDir, 'Service.log'));
trace.T('Service Begin...');
{$ENDIF}
// Windows 2003 Server requires StartServiceCtrlDispatcher to be
// called before CoRegisterClassObject, which can be called indirectly
// by Application.Initialize. TServiceApplication.DelayInitialize allows
// Application.Initialize to be called from TService.Main (after
// StartServiceCtrlDispatcher has been called).
//
// Delayed initialization of the Application object may affect
// events which then occur prior to initialization, such as
// TService.OnCreate. It is only recommended if the ServiceApplication
// registers a class object with OLE and is intended for use with
// Windows 2003 Server.
//
// Application.DelayInitialize := True;
//
if not Application.DelayInitialize or Application.Installing then
Application.Initialize;
Application.CreateForm(TSvcCrmHe, SvcCrmHe);
Application.Run;
{$IFDEF DEBUG}
trace.T('Service End...');
{$ENDIF}
end.