I would like to know how to do conversions from hex to decimal, i know how to do it by hand, i mean in a program is there a function that will let you automatically take a number from hex to decimal and back again.

More importntly, I would like to be able to read a hex string, and display it as assci in an edit box or display box

then take any changes and writh them back in to mem as hex.
Posted on 2002-03-20 15:19:04 by dionysus

if i've understood well, you want do dispaly an HEX number as string, in a edit control.

First possibility:

This routine i found somewhere translate a value in a byte to his HEX as string.

; **** routine WriteHex: Norton ****

WriteHex: push eax ;
push edx ;
push ecx ;
mov dl,IlByte ;
shr dl,4
call WriteHexDigit ;
mov dl,IlByte ;
and dl,0fh ;
inc ebx ;
call WriteHexDigit ;
pop ecx ;
pop edx ;
pop eax ;
ret ;

; **** routine WriteHexDigit: Norton ****

WriteHexDigit: cmp dl,10
jae HexLetter ; No, convert to letter
add dl,"0" ; Yes, to string number
jmp WriteDig ;
HexLetter: add dl,"A"-10 ; Convert to letter
WriteDig: mov al,dl ;
mov [ebx],al
call SendMessageA,EDITBOX,000Ch,0,offset buffer1

Second possibility:

to use something already in api like

could try:
Format1 db "%lX",0
call _wsprintfA, offset output1, offset Format1, Value

Bye B7
Posted on 2002-03-20 15:37:29 by Bit7