Einzelnen Beitrag anzeigen

zeras

Registriert seit: 11. Mär 2007
Ort: Saalkreis
1.618 Beiträge
 
Delphi 12 Athens
 
#11

AW: 32 Bit Wert verschieden interpretieren

  Alt 17. Mai 2012, 17:20
Ich habs nun mal so gemacht. Muss nur noch testen. Das Array ar4 enthält dann die 4 Bytes, unabhängig, ob es Single, LongWord oder LongInt ist.

Delphi-Quellcode:
Function WriteToSvr(Address: Longword; dValue: Longword): Boolean; overload;
var
  Adr1 : Longword;
  Wert : Longword;
  ar: ar4 absolute Wert;

begin
  Result := False;
  Adr1 := Address;
  Wert := dValue;

  If WriteToSvr3(Adr1, ar) then begin
    Result := True;
  end;
end;

Function WriteToSvr(Address: Longword; dValue: LongInt): Boolean; overload;
var
  Adr1 : Longword;
  Wert : LongInt;
  ar: ar4 absolute Wert;

begin

  Result := False;
  Adr1 := Address;
  Wert := dValue;

  If WriteToSvr3(Adr1, ar) then begin
    Result := True;
  end;
end;


Function WriteToSvr(Address: Longword; dValue: Single): Boolean; overload;
var
  Adr1 : Longword;
  Wert : Single;
  ar: ar4 absolute Wert;

begin
  Result := False;
  Adr1 := Address;
  Wert := dValue;

  If WriteToSvr3(Adr1, ar) then begin
    Result := True;
  end;
end;
Matthias
Es ist nie falsch das Richtige zu tun!
- Mark Twain
  Mit Zitat antworten Zitat