who can tell the code where is wrong?

.model flat,stdcall
option casemap:none
include windows.inc
include user32.inc
include kernel32.inc
includelib user32.lib
includelib kernel32.lib
s1 db 'the sum is %x',0
s2 db 'window',0

s3 db
mov eax,1
add eax,2
invoke wsprintf,addr s3,addr s1,eax
invoke MessageBox,NULL.offset s3,offset s2,MB_OK
invoke ExitProcess,NULL
end start
Posted on 2004-06-04 12:00:43 by cccer
one problem I see is, S3 needs to be larger than one byte.. you need to allocate space for it or statically in your .data declaration

such as:

S3 DB 40 DUP(0) ;make sure it is null terminated

This works for me:

S3 DB 80 DUP(0)
S2 DB "%s,%s",0


szText szClassName,"WankerLib_Class"
szText szDisplayName,"MASM32 Window"

invoke wsprintf,ADDR S3,ADDR S2,ADDR szClassName, ADDR szDisplayName
invoke MessageBox,NULL,ADDR S3, ADDR S2,MB_OK
Posted on 2004-06-04 12:32:51 by drarem
s3 db 255 dup (?)
mov eax,1
add eax,2
Posted on 2004-06-05 02:43:03 by purpleendurer

s1 db 'the sum is %x',0
sizeofs1string equ $ - offset s1

s3 db sizeofs1string+8+1 dup(00h)

no need for 255, overkill ;p considering its a %x hex number = 8 digits aint it?
Posted on 2004-06-05 05:26:46 by evlncrn8