Hey guys..

Wondering how I would go about getting text entered in a editbox (lets say the text entered is '4A' without the quotes) and converting it to decimal (no fast routines needed just something like wsprintf) and putting the result in another edit box. Any ideas? Would go something like this right?




.data
Format db '%ld',0

.data?
Hex db 80 dup (?)
Buffer db 80 dup (?)

invoke GetDlgItemText,Hwin,IDC_HEX,addr Hex,80
invoke wsprintf, addr Buffer, addr Format, add Hex
invoke SetDlgItemText,Hwin,IDC_DECIMAL,addr Buffer,80


Any help is appreciated

RIF
Posted on 2004-02-13 18:41:23 by resistance_is_futile
Nope, that approach won't work. If you wanted to get a normal integer and show it's hex equivalent, it would be easy: GetDlgItemInt + wsprintf with the formatstring %x or %X or %08X (depending on whether you want upper/lower case and leading zeroes) :).

Since you want hex->dec, you need to perform the hexstring -> machine dword yourself. However, there's code in the masm32 support lib to do this - I think the function name is dwtoa or similar, but do take a look at the help file for the masm32 support lib, it's probably mentioned there.
Posted on 2004-02-13 19:24:56 by f0dder
okay cool thanks a lot! Got it to work :D
Posted on 2004-02-13 19:44:29 by resistance_is_futile
glad to have helped
Posted on 2004-02-13 19:58:31 by f0dder