Hi i try to make a counter who counts from 1-255. i use a editfield with a value of 1. i add 1 to the 1 of the editfield and i got 2. now i insert the 2 into the editfield and press the button again....i add to the 2 of the editfield 1 again and got 3 :) all works fine. but if i reach the 9 and add 1 to it,i got : and not 10 ???? what happends ??? some one like to explain me what i dont see or show me a short example on how i can count to 255 ? Thanks a lot ! cu
Posted on 2001-03-23 04:11:00 by Workaholic
you're adding 1 to the ascii value 57 (9) which gives you ascii value 58
(:)
what you need to do is increase a countervalue not it's editbox ascii counterpart. After you've done that you need to convert that value to text. Check the masm libraries for related functions, no need to reinvent the wheel. This message was edited by Hiroshimator, on 3/23/2001 5:21:06 AM
Posted on 2001-03-23 04:19:00 by Hiroshimator
It looks like you're adding 1 to the value "1" to decimal 1, so it's producing the next character after the 9 which is a colon ":" What you need to do is use a decimal value, then convert it into a string using dwtoa. umbongo
Posted on 2001-03-23 04:20:00 by umbongo
Hi, You can do: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; .data buffer db 256 dup(0) ;(or less than 256) .code ...;here you press the button invoke GetDlgItemText,hWnd,IDC_EDIT,ADDR buffer,256 invoke atodw, addr buffer add eax,1 invoke dwtoa, eax, addr buffer invoke SetDlgItemText,hWnd,IDC_EDIT,addr buffer ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; IDC_EDIT is the ID of your edit control Don't forget to add the bothh includes :masm32.inc & .lib for the atodw & dwtoa calls. Maybe you can use the GetDlgItemInt APi, I didn't try now.
Posted on 2001-03-23 07:15:00 by Vom-bonjour:-()
Would it not be easier to create the edit with the ES_NUMBER style, and then use GetDlgItemInt & SetDlgItemInt? Or am I missing something rather obvious here? Also, if possible would it not be better to move the integer to a local rather than the edit box, then its just a case of:

inc myCount
invoke SetDlgItemInt, hWnd, IDC_EDIT, myCount, FALSE
Mirno
Posted on 2001-03-23 07:48:00 by Mirno