unit Unit2;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, SvcMgr, Dialogs;
type
TService2 =
class(TService)
procedure ServiceStart(Sender: TService;
var Started: Boolean);
private
txt_logfile: textFile;
{ Private-Deklarationen }
public
function GetServiceController: TServiceController;
override;
{ Public-Deklarationen }
end;
var
Service2: TService2;
implementation
{$R *.DFM}
procedure ServiceController(CtrlCode: DWord);
stdcall;
begin
Service2.Controller(CtrlCode);
end;
function TService2.GetServiceController: TServiceController;
begin
Result := ServiceController;
end;
procedure TService2.ServiceStart(Sender: TService;
var Started: Boolean);
begin
try
AssignFile(txt_logfile, '
sensor.log');
Append(txt_logfile);
DateSeparator:='
/';
Writeln(txt_logfile, FormatDateTime('
yyyy/mm/dd hh:nn:ss',Now));
Flush(txt_logfile);
CloseFile(txt_logfile);
except
end;
end;
end.