flat assembler
Message board for the users of flat assembler.
Index
> Windows > can't figure how to output numbers in a message box |
Author |
|
sinsi 18 May 2008, 03:52
Try using wsprintf to convert your number to a string.
Code: include '\fasm\include\win32ax.inc' .code mbtitle db 'Life, the Universe and Everything', 0 mbtext db '%lu',0 number dd 42 start: invoke wsprintf,buffer,mbtext,[number] invoke MessageBox,HWND_DESKTOP,buffer,mbtitle,MB_OK invoke ExitProcess,0 .data buffer rb 256 .end start P.S. your code invoking MessageBox is missing a parameter. |
|||
18 May 2008, 03:52 |
|
fatdogs12 18 May 2008, 04:35
Thanks a billion (or a buffer overflow), I actually came across the wsprintf function a minute or two after I posted and spent another hour trying to get it work, except that it crashed every time. After seeing your code I put that data segment at the end of the start block and that fixed everything.
So thanks, both ways, without the sample code I'd have been dead. Cured my headache |
|||
18 May 2008, 04:35 |
|
LocoDelAssembly 18 May 2008, 17:19
It is "cinvoke wsprintf,buffer,mbtext,[number]". It doesn't harm in this particular situation but cdecl functions must be called with cinvoke/ccall or just plain assembly and adjusting ESP after the call.
|
|||
18 May 2008, 17:19 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.