...Werte in Hex-Darstellung anzeigen?
Autor: Marc Dürst
function HexB(b: Byte): string;
const
HexChar: array[0..15] of char = '0123456789ABCDEF';
begin
HexB := HexChar[b shr 4] + HexChar[b and $0F];
end;
function HexW(w: Word): string;
begin
HexW := HexB(Hi(w)) + HexB(Lo(w));
end;
function HexL(l: Longint): string;
var
HL: HiLo absolute l;
begin
HexL := HexW(HL.HiWord) + HexW(HL.LoWord);
end;
function HexP(p: Pointer): string;
var
HL: HiLo absolute p;
begin
HexP := HexW(HL.HiWord) + ':' + HexW(HL.LoWord);
end;
printed from
www.swissdelphicenter.ch
developers knowledge base