i cant find my mistake: (adding 1 + 1 )



[color=blue] .elseif eax==1005 [color=green];/* ADD */
[/color] invoke GetDlgItemInt,hWin,1001,0,TRUE
mov edx,[color=red]eax[/color]
invoke GetDlgItemInt,hWin,1002,0,TRUE
mov ebx,[color=red]eax[/color]
mov [color=red]eax[/color],edx
add [color=red]eax[/color],ebx
mov ecx,Result
mov [ecx],[color=red]eax[/color]
invoke dwtoa,Result, addr buffer
invoke MessageBox,hWin,addr buffer,offset AppName,MB_OK

[/color]


thanks

Ranma_at
Posted on 2003-11-21 02:35:55 by Ranma_at
mov ecx, offset Result
Posted on 2003-11-21 03:22:33 by benny
no, not working ;)



lea eax, Result ;or
mov eax, offset Result


i get then no error but a wrong result
btw my Result is a local DWORD
Posted on 2003-11-21 03:25:38 by Ranma_at
would u like to post your program's source code? :)
Posted on 2003-11-21 03:38:45 by benny
You must save edx before the second GetDlgItemInt
Posted on 2003-11-21 04:07:11 by Delight
thanks delight ;)



.elseif eax==1005 ;/* ADD */
invoke GetDlgItemInt,hWin,1001,0,TRUE
mov edx,eax
push edx
invoke GetDlgItemInt,hWin,1002,0,TRUE
pop edx
mov ebx,eax
mov eax,edx
add eax,ebx
lea ecx,Result
mov [ecx],eax
invoke dwtoa,Result, addr buffer
invoke MessageBox,hWin,addr buffer,offset AppName,MB_OK


works fine now...
Posted on 2003-11-21 04:10:50 by Ranma_at
Ranma_at,

ebx is preserved across WinAPI calls, so you might do this:


.elseif eax==1005 ;/* ADD */
invoke GetDlgItemInt,hWin,1001,0,TRUE
[COLOR=teal];mov edx,eax
;push edx[/COLOR]
[color=blue]mov ebx,eax[/color]
invoke GetDlgItemInt,hWin,1002,0,TRUE
[COLOR=teal];pop edx
;mov ebx,eax
;mov eax,edx[/color]
add eax,ebx
lea ecx,Result
mov [ecx],eax
invoke dwtoa,Result, addr buffer
invoke MessageBox,hWin,addr buffer,offset AppName,MB_OK
Posted on 2003-11-21 05:55:35 by Morris
Also remember to preserve EBX in the dialog proc:


DialogProc proc uses ebx hWin,uMsg,wParam,lParam
Posted on 2003-11-22 08:40:23 by QvasiModo
Thanks QvasiModo,

i forgot the preservation :rolleyes:
Posted on 2003-11-22 11:01:43 by Ranma_at