unit MainUnit; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, scConnectEncrypt, ExtCtrls; type TfrmMain = class(TForm) MeText: TMemo; Label3: TLabel; Edit3: TEdit; btnCheck: TButton; Timer1: TTimer; procedure btnCheckClick(Sender: TObject); procedure Timer1Timer(Sender: TObject); private public { Public declarations } end; var frmMain: TfrmMain; implementation {$R *.dfm} procedure TfrmMain.btnCheckClick(Sender: TObject); var d: LongInt; a: array [0..2] of Byte; b: PByte; begin b := @a; // b := @d; if ReadDogData($52, 3, b) then MeText.Lines.Add('Good Connection') else MeText.Lines.Add('Disconnection'); end; procedure TfrmMain.Timer1Timer(Sender: TObject); begin btnCheck.Click; CloseConnection; if not Open(2) then Application.Terminate; end; initialization if not Open(2) then Application.Terminate; finalization CloseConnection; end.