Hi,

I was just wondering if it were possible for me to convert a ASCII (byte value) number, such as 12345 into the same value in WORD.

For example, i would like my users to enter a number in a editbox, but how would i then convert this into a 16bit value?

[...]

.data?
buffer BYTE 256 dup(0)

.code
invoke GetWindowText, hEdit, addr buffer, 256
;trim the buffer
mov myvalue, [buffer] <-----how would i make the number in 'buffer' become a WORD value?


i was thinking something like word ptr , but i don't think that does what i want it to...

any help will be greatly appreciated!!!
Posted on 2003-05-12 19:29:18 by Drocon
If your using masm32 use atodw

invoke atodw,ADDR MyAsciiNumber

eax contains the DWORD value so just mov ax

mov MyWORDNumber,ax
Posted on 2003-05-12 19:42:30 by donkey
If your Edit control is in a dialog box, you could retrieve the binary number with the GetDlgItemInt function.

Raymond
Posted on 2003-05-12 21:44:38 by Raymond

If your using masm32 use atodw

invoke atodw,ADDR MyAsciiNumber

eax contains the DWORD value so just mov ax

mov MyWORDNumber,ax


ah, i c, many thanks :) i will test it out shortly

Thanx!
Posted on 2003-05-12 21:47:12 by Drocon