Показать сообщение отдельно
  #2  
Старый 02.07.2010, 17:02
ifmomax ifmomax вне форума
Прохожий
 
Регистрация: 29.06.2010
Сообщения: 3
Репутация: 10
По умолчанию

Код:
unit Unit1;
{$A-}
interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, SvcMgr, Dialogs,
  ExtCtrls,Mlog;

type
  TAntorTestRead = class(TService)
    Timer1: TTimer;
    procedure Timer1Timer(Sender: TObject);
   { procedure ServiceExecute(Sender: TService);}
  private
    { Private declarations }
  public
    function GetServiceController: TServiceController; override;
    { Public declarations }
  end;

type
  TGPS12Data = record
    Atr:Longint; // 4
    Latitude:Longint; // 4
    longitude:Longint; // 4
end;

var
  AntorTestRead: TAntorTestRead;
  ReadData: TGPS12Data;
  log:TMlog;
  myFile: file of TGPS12Data;


implementation

{$R *.DFM}

procedure ServiceController(CtrlCode: DWord); stdcall;
begin
  AntorTestRead.Controller(CtrlCode);
end;

function TAntorTestRead.GetServiceController: TServiceController;
begin
  Result := ServiceController;
end;

function IntToBin(Value: integer; Digits: integer): string;
var
  i: integer;
begin
  result := '';
for i := 0 to Digits - 1 do
  if Value and (1 shl i) > 0 then
    result := '1' + result
  else
    result := '0' + result;
end;


{procedure TAntorTestRead.ServiceExecute(Sender: TService);
begin
  Timer1.Enabled := True;
while not Terminated do
  ServiceThread.ProcessRequests(True);// wait for termination
  Timer1.Enabled := False;
end;}

procedure TAntorTestRead.Timer1Timer(Sender: TObject);
var
ss:widestring;
i:integer;
begin
   ss:=ParamStr(0);
   i:=Length(ss)-Length('AntorTest.exe');
   ss:=Copy(ss, 1, i);
   log:=TMlog.create(ss+'LogFile.log');
   AssignFile(myFile, '34701-310510.bin');
   FileMode := fmOpenRead;
   Reset(myFile);
   while not Eof(myFile) do begin
     read(myfile,ReadData);
     log.mess(inttoBin(ReadData.atr,32));
   end;
   Timer1.Destroy;
end;


end.
Ответить с цитированием