Use this function

function IntToHex(Value: Integer; Digits: Integer): string;
//  FmtStr(Result, '%.*x', [Digits, Value]);
asm
       CMP     EDX, 32        // Digits < buffer length?
       JBE     @A1
       XOR     EDX, EDX
@A1:    PUSH    ESI
       MOV     ESI, ESP
       SUB     ESP, 32
       PUSH    ECX            // result ptr
       MOV     ECX, 16        // base 16     EDX = Digits = field width
       CALL    CvtInt
       MOV     EDX, ESI
       POP     EAX            // result ptr
       CALL    [EMAIL PROTECTED]
       ADD     ESP, 32
       POP     ESI
end;

function IntToHex(Value: Int64; Digits: Integer): string;
//  FmtStr(Result, '%.*x', [Digits, Value]);
asm
       CMP     EAX, 32        // Digits < buffer length?
       JLE     @A1
       XOR     EAX, EAX
@A1:    PUSH    ESI
       MOV     ESI, ESP
       SUB     ESP, 32        // 32 chars
       MOV     ECX, 16        // base 10
       PUSH    EDX            // result ptr
MOV EDX, EAX // zero filled field width: 0 for no leading zeros
       LEA     EAX, Value;
       CALL    CvtInt64

       MOV     EDX, ESI
       POP     EAX            // result ptr
       CALL    [EMAIL PROTECTED]
       ADD     ESP, 32
       POP     ESI
end;

----- Original Message ----- From: "websmith" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Thursday, June 09, 2005 8:55 AM
Subject: display integer value in Hex


at this junction, struggling with showing an integer value in Hex to be displayed in a label caption.

for example if the value of an integer variable has 10 in decimal, would need to show it as 0A in the label.

how ? what's your advise.

ciao

_______________________________________________
Delphi mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi



_______________________________________________
Delphi mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi

Reply via email to