News:

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

Question on Marcos

Started by sayain_code, January 03, 2010, 11:05:58 AM

Previous topic - Next topic

sayain_code

Hey i  just work  around with masm trying to figure out marcos. How do i make a simple marco to get Text string and out put that to messageBox?



dbMsg_Capt db 'Caption',0
TextMsg_buff db ?
TextMsg MACRO Text:VARARG
mov eax,Text
mov TextMsg_buff,eax

invoke MessageBox,hWin,addr TextMsg_buff,addr dbMsg_Capt,MB_OK

endm







hutch--

 :bg

Try and existing one.


fn MessageBox hWnd,"Howdy, I am a message box","The Title",MB_OK


Inclusde the masm32 macro file and you can use all of them.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

fearless

If its just a quick messagebox thing, you could base it on the CTEXT macro found in the MASM32: (masm32\macros\macros.asm)

CTEXT macro Text
    local szText
    .data
    szText byte Text, 0
    .code
    exitm <offset szText>   
endm


TextMsg MACRO Text
LOCAL __TextMsg_buff
.data
__TextMsg_buff db Text,0
.code
invoke MessageBox,hWin,addr__TextMsg_buff,addr dbMsg_Capt,MB_OK
EXITM <eax>
ENDM


with your dbMsg_Capt db 'Caption',0 being defined in the main .data section of your asm file.
ƒearless