Hi,
I don't know much about masm macros but I tried and I can't get it to work. What is my mistake in the code below or I should say first... is it possible ?
MENUCREATE MACRO MenuCount:REQ
LOCAL count
count = 1
WHILE count LE MenuCount
add edi, 1
invoke InsertMenuA, esi, %count, MF_STRING, edi, addr @CATSTR(<szMenu>,%count)
test eax, eax
jz No_Menu_Added
count = count + 1
ENDM
ENDM
The output I'm looking for is...
add edi, 1
invoke InsertMenuA, esi, 1, MF_STRING, edi, addr szMenu1
test eax, eax
jz No_Menu_Added
add edi, 1
invoke InsertMenuA, esi, 2, MF_STRING, edi, addr szMenu2
test eax, eax
jz No_Menu_Added
...
Thanks
The function form of CATSTR is @CatStr. I believe this statement is correct:
invoke InsertMenuA, esi, count, MF_STRING, edi, @CatStr(<addr szMenu>,%count)
Why not automate it further? You could, for example, pass the item string and have the macro add it to the data section.
Thanks Michael. Problem solved.
:U
jdoe,
Here is the complete reference for macro functions :
http://webster.cs.ucr.edu/Page_TechDocs/MASMDoc/ProgrammersGuide/Chap_09.htm