12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- unit Unit1;
- interface
- uses
- Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
- Dialogs, StdCtrls, ExtCtrls;
- type
- TForm1 = class(TForm)
- ldeBudget: TLabeledEdit;
- ldeBills: TLabeledEdit;
- ldeEstimate: TLabeledEdit;
- btnWrite: TButton;
- btnRead: TButton;
- Label1: TLabel;
- procedure btnWriteClick(Sender: TObject);
- procedure btnReadClick(Sender: TObject);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
- var
- Form1: TForm1;
- implementation
- {$R *.dfm}
- var
- DogAddr: integer;
- DogBytes: integer;
- DogData: ^byte;
- function WriteDog: LongInt; external;
- function ReadDog: LongInt; external;
- {$L rgdlw32d.obj}
- procedure TForm1.btnWriteClick(Sender: TObject);
- var
- iBillsCount, iBudgetCount, iEstimateCount: Integer;
- arrData: array [0..2] of Byte;
- begin
- try
- iBudgetCount := StrToInt(ldeBudget.Text);
- iBillsCount := StrToInt(ldeBills.Text);
- iEstimateCount := StrToInt(ldeEstimate.Text);
- except
- Exit;
- end;
- arrData[0] := iBillsCount;
- arrData[1] := iBudgetCount;
- arrData[2] := iEstimateCount;
- DogAddr := $52;
- DogBytes := Length(arrData);
- DogData := @arrData;
- if WriteDog <> 0 then ShowMessage('д¹·Ê§°Ü£¡');
- end;
- procedure TForm1.btnReadClick(Sender: TObject);
- var
- arrData: array [0..2] of Byte;
- begin
- DogAddr := $52;
- DogBytes := Length(arrData);
- DogData := @arrData;
- if ReadDog = 0 then
- begin
- ldeBills.Text := IntToStr(arrData[0]);
- ldeBudget.Text := IntToStr(arrData[1]);
- ldeEstimate.Text := IntToStr(arrData[2]);
- end
- else ShowMessage('¶Á¹·Ê§°Ü£¡');
- end;
- end.
|