hello,
my name is marco, i'm new in win asm and i ask if someone can help me,
i want to do arithmetic operation and here no problem,but i want to display the result in a message box or dialog box and i can't do it.
i have tried with str$ or dwtoa but the first is not regognized in win asm and dwtoa give an ascii string not the value.
can someone give me the solution?
thanks in advance!
8 replies to this topic
#1
Posted 13 August 2011 - 05:09 PM
|
|
|
#2
Posted 13 August 2011 - 06:38 PM
I am sure the mods will move this to the ASM forum not tutorials, but to answer you anyways... You have a number and want to display it in a message box? Well you have to convert it first to an ascii string which dwtoa does...
So, how would this not work?
So, how would this not work?
xor eax, eax
add eax, 10
invoke dwtoa, eax, offset lpNum
invoke MessageBox, NULL, offset lpNum, NULL, MB_OK
#3
Posted 13 August 2011 - 07:06 PM
Quote
xor eax, eax add eax, 10 invoke dwtoa, eax, offset lpNum invoke MessageBox, NULL, offset lpNum, NULL, MB_OK
If you use EAX with INVOKE while one of the arguments is an ADDR, MASM32 will complain.
#4
Posted 13 August 2011 - 07:11 PM
Not really.... If eax is BEFORE addr then yes, eax will get over written IF addr is referencing a local.... IF NOT then no problems. NO PROBS using OFFSET or ADDR if it is NOT a local.... I only use ADDR where it is needed really for LOCALS
#5
Posted 13 August 2011 - 07:25 PM
Quote
Not really.... If eax is BEFORE addr then yes, eax will get over written IF addr is referencing a local.... IF NOT then no problems. NO PROBS using OFFSET or ADDR if it is NOT a local.... I only use ADDR where it is needed really for LOCALS
#6
Posted 13 August 2011 - 08:25 PM
Better? :P
push ebp
mov ebp, esp
sub esp , 10
xor eax, eax
add eax, 10
push ebp
push eax
call dwtoa
push MB_OK
push NULL
push ebp
push NULL
call MessageBox
add esp, 10
pop ebp
#7
Posted 13 August 2011 - 08:40 PM
Yeah, but this is the syntax I'm used to:
enter 10, 0 xor eax, eax add eax, 10 push dword ptr offset someStr push eax call dwtoa push dword ptr 0 push dword ptr 0 push dword ptr offset someStr push dword ptr 0 call MessageBox leave
#8
Posted 14 August 2011 - 12:32 PM
thank you very much it works now!
only another question please...is correct if i have two edit box where i type numbers and i use atodw to convert and add the numbers?
only another question please...is correct if i have two edit box where i type numbers and i use atodw to convert and add the numbers?
#9
Posted 14 August 2011 - 12:45 PM
Well, as long as it works, and does what it's supposed to, it should be okay.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account

Back to top









