News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

How could I push literal text to a function?

Started by Germain, March 13, 2010, 06:54:39 AM

Previous topic - Next topic

Germain

Hi to all :)

I would like to know how could I push literal text to a function...

for example, if I use a messagebox, the normal way is this:

invoke MessageBox, NULL, addr Message, addr Title, MB_OK

right?

but all I want to do is this:

invoke MessageBox, NULL, "lalalalal =D", "my title :D", MB_OK

I've tested a macro made by myself but it doesn't work :/

   T MACRO TEXT
   .data
      Text_ byte MAX_PATH dup (?)
   .code
   
   mov eax, sizeof TEXT
   xor edi, edi
   
      .repeat
         mov bl, byte ptr TEXT
         mov byte ptr [Text_+edi], bl
         inc edi
      .until edi == eax
      
      push offset Text_
   ENDM


I was using it like this:
T <"ABC">

But I got an error xD

Anyone can help me?

I would appreciate your help :)

Thanks in advance ;)

hutch--

#1
Germain,

Have a look at the available macros for simplifies text handling.


fn MessageBox,hWnd."Text Message","Title",MB_OK

; or

mov var, rv(MessageBox,hWnd."Text Message","Title",MB_YESNO)


You must have the macros.asm file included to use them.

God I hate these new keyboards. !!!!
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

BlackVortex

In GoAsm you can do this :
invoke MessageBox, NULL,"Test1","Title",MB_OK

Also, I've made a macro :
MBox(%lpText,%lpTitle) MACRO
INVOKE MessageBox,0,addr %lpText,addr %lpTitle,MB_OK
ENDM


So I can quickly do :
MBox("Text1",addr sz_title)
or
MBox("Text1","MyTitle")

Slugsnack

invoke MessageBox, NULL, chr$("lalalalal =D"), chr$("my title :D"), MB_OK

Germain

Quote from: BlackVortex on March 13, 2010, 08:15:47 AM
In GoAsm you can do this :
invoke MessageBox, NULL,"Test1","Title",MB_OK

Also, I've made a macro :
MBox(%lpText,%lpTitle) MACRO
INVOKE MessageBox,0,addr %lpText,addr %lpTitle,MB_OK
ENDM


So I can quickly do :
MBox("Text1",addr sz_title)
or
MBox("Text1","MyTitle")


Thanks to all :P

I liked your macro :dance: