Problem with result in the my calculator

Started by siCk, March 09, 2005, 04:39:19 PM

Previous topic - Next topic

siCk

i have one little problem :(. i have result in eax for example  8ACD5634 and i  want to show result in the edit i use

    invoke setwindowtext ..., addr eax (offset eax, eax)

and didn't work:( i tried do something that

    mov dword ptr [ebp], eax (or other register)
    invoke setwindowtext ..., ebp

then edit show me #:"_#@$@#$@#$ how can i change that? :(
i want see true result in edit for example  8ACD5634

                                                                                                             thanks
   

AeroASM

Your value in eax is a number , whereas SetWindowText requires the addr of a string.

You need to convert the number to a string, like this:


...
;link to the masm32 library so we can invoke the dw2ah proc
include \masm32\include\masm32.inc
includelib \masm32\lib\masm32.lib
...
.data
...
;create a buffer to store the string in
[b]szBuffer db 32 dup(0)[/b]
...
.code
...
;get the value in eax
;convert it to a string and store in szBuffer
invoke dw2ah,eax,addr szBuffer
;set the edit control text
invoke SetWindowText ...,addr szBuffer
...

wjr

If you have Jeremy Gordon's GoBug (or Testbug), the Testbug help file also has some translation routines - see the Index under "hex dump, to screen".