Unit1.pas 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. unit Unit1;
  2. interface
  3. uses
  4. Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  5. Dialogs, StdCtrls, ExtCtrls;
  6. type
  7. TForm1 = class(TForm)
  8. ldeBudget: TLabeledEdit;
  9. ldeBills: TLabeledEdit;
  10. ldeEstimate: TLabeledEdit;
  11. btnWrite: TButton;
  12. btnRead: TButton;
  13. Label1: TLabel;
  14. procedure btnWriteClick(Sender: TObject);
  15. procedure btnReadClick(Sender: TObject);
  16. private
  17. { Private declarations }
  18. public
  19. { Public declarations }
  20. end;
  21. var
  22. Form1: TForm1;
  23. implementation
  24. {$R *.dfm}
  25. var
  26. DogAddr: integer;
  27. DogBytes: integer;
  28. DogData: ^byte;
  29. function WriteDog: LongInt; external;
  30. function ReadDog: LongInt; external;
  31. {$L rgdlw32d.obj}
  32. procedure TForm1.btnWriteClick(Sender: TObject);
  33. var
  34. iBillsCount, iBudgetCount, iEstimateCount: Integer;
  35. arrData: array [0..2] of Byte;
  36. begin
  37. try
  38. iBudgetCount := StrToInt(ldeBudget.Text);
  39. iBillsCount := StrToInt(ldeBills.Text);
  40. iEstimateCount := StrToInt(ldeEstimate.Text);
  41. except
  42. Exit;
  43. end;
  44. arrData[0] := iBillsCount;
  45. arrData[1] := iBudgetCount;
  46. arrData[2] := iEstimateCount;
  47. DogAddr := $52;
  48. DogBytes := Length(arrData);
  49. DogData := @arrData;
  50. if WriteDog <> 0 then ShowMessage('д¹·Ê§°Ü£¡');
  51. end;
  52. procedure TForm1.btnReadClick(Sender: TObject);
  53. var
  54. arrData: array [0..2] of Byte;
  55. begin
  56. DogAddr := $52;
  57. DogBytes := Length(arrData);
  58. DogData := @arrData;
  59. if ReadDog = 0 then
  60. begin
  61. ldeBills.Text := IntToStr(arrData[0]);
  62. ldeBudget.Text := IntToStr(arrData[1]);
  63. ldeEstimate.Text := IntToStr(arrData[2]);
  64. end
  65. else ShowMessage('¶Á¹·Ê§°Ü£¡');
  66. end;
  67. end.