How to display eax register in MessageBox. Please advice.

Started by Robin1985, February 15, 2010, 08:41:56 PM

Previous topic - Next topic

Robin1985

Hello. Please help. Here is a source code:

.386                                           
.RADIX 10                                   
.model flat, stdcall                         

option casemap:none                   

includelib \masm32\lib\kernel32.lib             
includelib \masm32\lib\user32.lib

include \masm32\include\kernel32.inc       
include \masm32\include\user32.inc
include \masm32\include\windows.inc


.data                                           


.code                                           
MsgText db "Works", 0
MsgTitle db "This is a messagebox",0


start:                                         

invoke MessageBox, NULL, ADDR MsgText, ADDR MsgTitle, MB_OK or MB_ICONINFORMATION 
invoke ExitProcess, NULL

end start





Please help me how I can display calculation in MessageBox like "mov eax, 8; mov ebx, eax" and to display 8(ebx) in MessageBox.

oex


.386                                           
.RADIX 10                                   
.model flat, stdcall                         

option casemap:none                   

includelib \masm32\lib\kernel32.lib             
includelib \masm32\lib\user32.lib

include \masm32\include\kernel32.inc       
include \masm32\include\user32.inc
include \masm32\include\windows.inc


.data                                           


.code                                           
MsgText db "Works", 0
MsgTitle db "This is a messagebox",0


start:                                         

mov eax, 8;
mov ebx, eax

invoke MessageBox, NULL, str$(ebx), ADDR MsgTitle, MB_OK or MB_ICONINFORMATION 
invoke ExitProcess, NULL

end start
We are all of us insane, just to varying degrees and intelligently balanced through networking

http://www.hereford.tv

Vortex

.386
.model flat,stdcall
option casemap:none

include     \masm32\include\windows.inc
include     \masm32\include\kernel32.inc
include     \masm32\include\user32.inc

includelib  \masm32\lib\kernel32.lib
includelib  \masm32\lib\user32.lib

.data

format1     db 'The value of eax = %d',0
capt        db 'Hello',0

.data?

buffer      db 100 dup(?)

.code

start:

    mov     eax,100
    invoke  wsprintf,ADDR buffer,ADDR format1,eax
    invoke  MessageBox,0,ADDR buffer,ADDR capt,MB_OK
    invoke  ExitProcess,0

END start