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.
Posted on 2001-08-22 03:10:17 by vcv
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.


Posted on 2001-08-22 03:14:35 by hutch--
if its so weak... then usw this one->

icall MACRO return, Function : REQ, vars : VARARG
ifnb <vars>
invoke Function, vars
invoke Function
mov return, eax

Posted on 2001-08-22 05:21:39 by vineon
This may seem trivial, but I'm not sure if that's technically an invoke-like macro since it uses invoke. ;)
Posted on 2001-08-22 07:31:46 by Will
ah, thank you both, perfect :)
Posted on 2001-08-22 11:49:18 by vcv
I personally prefer inline routines, as they seem more readable.. (this is a variation on Vineon's post).


IFNB <args>
invoke Function, args
invoke Function
EXITM <eax>

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..

Posted on 2001-08-22 12:11:52 by NaN
Very nice :) Such nice macros to choose from, I don't know which one to pick...
Posted on 2001-08-22 12:31:30 by vcv