Kod: Tümünü seç
function TForm1.DataNumLongSAdr(format:word;high:variant;low:variant;EngHigh:variant;englow:Variant;net:byte;adres:word):word;
type
GUI_dtnumericptr=^GUIdtnumeric;
GUIdtnumeric= packed record
dataformat:word;
datamax:integer;
datamin:integer;
gain:integer;
offset:integer;
netadr:byte;
data:word;
end;
var
DtNumericptr:GUI_dtnumericptr;
index:word;
begin
Getmem(DTNumericptr,Sizeof(GUIdtNumeric));
DataTable[DTCount]:=DataOffset;
DTNumericptr^.dataformat:=format;
DTNumericptr^.datamax:=high;
DTNumericptr^.datamin:=low;
DTNumericptr^.gain:=EngHigh;
DTNumericptr^.offset:=EngLow;
DTNumericptr^.netadr:=net;
DTNumericptr^.data:=adres;
for index:=0 to Sizeof(GUIdtNumeric)-1 do
Byte(pointer(longword(Dataadr)+DataOffset+Index)^):=Byte(Pointer(Integer(DTNumericptr)+ Index)^);
DataOffset:=DataOffset+Sizeof(GUIdtNumeric);
Freemem(DTNumericptr);
Result:=DataTableCount;
inc(DataTableCount);
end;
göndereceğim değerin tipine göre tip tanımındaki değişken tiplerini değiştirebileek kolay bir yöntem arıyorum.