I'm not very keen on how Macros work, but would it be possible to make a function in MASM that could be called like this:
invoke2 CommandLine, GetCommandLine
which would be equivalent to:
invoke GetCommandLine???????????????????????
mov CommandLine,eax
of course, it would have to accept parameters like invoke.
invoke2 CommandLine, GetCommandLine
which would be equivalent to:
invoke GetCommandLine???????????????????????
mov CommandLine,eax
of course, it would have to accept parameters like invoke.
Have a look at a piece of the example code from MASM32 SP2 called "scall", it already does what you are after so if you want to make a sinmilar macro, use this one as a guide.
Its weakness is that it does not parameter chaecking like "invoke" does so it is finally not as reliable.
Regards,
hutch@pbq.com.au
Its weakness is that it does not parameter chaecking like "invoke" does so it is finally not as reliable.
Regards,
hutch@pbq.com.au
if its so weak... then usw this one->
icall MACRO return, Function : REQ, vars : VARARG
ifnb <vars>
invoke Function, vars
else
invoke Function
endif
mov return, eax
ENDM
This may seem trivial, but I'm not sure if that's technically an invoke-like macro since it uses invoke. ;)
ah, thank you both, perfect :)
I personally prefer inline routines, as they seem more readable.. (this is a variation on Vineon's post).
Its use would then be:
Where the $INVOKE() macro eventually gets replaced wity 'eax' in the mov statement..
Anywho, just an alternate solution..
NaN
$INVOKE MACRO Function:REQ, args:VARARG
IFNB <args>
invoke Function, args
ELSE
invoke Function
ENDIF
EXITM <eax>
ENDM
Its use would then be:
mov hEdit1, $INVOKE( GetDlgItem, hWnd, 6001 )
Where the $INVOKE() macro eventually gets replaced wity 'eax' in the mov statement..
Anywho, just an alternate solution..
NaN
Very nice :) Such nice macros to choose from, I don't know which one to pick...