MainUnit.pas 996 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. unit MainUnit;
  2. interface
  3. uses
  4. Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  5. Dialogs, StdCtrls, scConnectEncrypt, ExtCtrls;
  6. type
  7. TfrmMain = class(TForm)
  8. MeText: TMemo;
  9. Label3: TLabel;
  10. Edit3: TEdit;
  11. btnCheck: TButton;
  12. Timer1: TTimer;
  13. procedure btnCheckClick(Sender: TObject);
  14. procedure Timer1Timer(Sender: TObject);
  15. private
  16. public
  17. { Public declarations }
  18. end;
  19. var
  20. frmMain: TfrmMain;
  21. implementation
  22. {$R *.dfm}
  23. procedure TfrmMain.btnCheckClick(Sender: TObject);
  24. var
  25. d: LongInt;
  26. a: array [0..2] of Byte;
  27. b: PByte;
  28. begin
  29. b := @a;
  30. // b := @d;
  31. if ReadDogData($52, 3, b) then
  32. MeText.Lines.Add('Good Connection')
  33. else
  34. MeText.Lines.Add('Disconnection');
  35. end;
  36. procedure TfrmMain.Timer1Timer(Sender: TObject);
  37. begin
  38. btnCheck.Click;
  39. CloseConnection;
  40. if not Open(2) then Application.Terminate;
  41. end;
  42. initialization
  43. if not Open(2) then Application.Terminate;
  44. finalization
  45. CloseConnection;
  46. end.