can anyone give me a tip (or tips) on how to create an array of strings (they will be no longer than 64 characters), and be able to access the array with ease? i would like to get around declaring x number of variables to hold the values. thanks.
Posted on 2002-06-27 13:37:47 by freedumb
ok, to avoid "a lot of variables", you should define a label...
Here's a little and simple quick-and-dirty hacky code snippet.
I think this is a good way to do it, although the macro needs
some work, and the example code is silly.

@String MACRO xxx:req
local theStr
CONST segment
theStr db xxx, 0
CONST ends
EXITM <offset theStr>
stringTable label DWORD
dd @String("lalala")
dd @String("Second entry")
dd @String("It does seem to work")
dd @String("mmoooooooOooooooooooh")
stringTableEnd LABEL DWORD
mov ebx, ((offset stringTableEnd - offset stringTable) / 4) - 1
mov eax, [stringTable + ebx*4]
invoke MessageBox, NULL, eax, eax, MB_OK
dec ebx
jns @@loop
invoke ExitProcess, 0
Posted on 2002-06-27 14:13:06 by f0dder
make each string 64 Bytes by zero padding the sorter ones then use 64*string index to get to each one

you beat me f0dder
Posted on 2002-06-27 14:13:32 by Kudos
This is a complex macro (i never bothered to comment it) but it does what you want.

strtbl macro _name:req, _strings:vararg
local @@lbl
$s equ <>
_data segment
p_&_name& label byte
irp $v, <_strings>
$l catstr <@@lbl>, %o@
ifidn <$v>, <"">
$l byte 0
$l byte $v, 0
$s catstr $s, <,>, $l
o@ = o@ + 1
byte 0
align 4
_name dword @SubStr(<%$s>, 2)
_data ends

strtbl tips, "Cut", "Copy", "Paste", "Undo", "Redo"

tips[0]=addr "Cut", tips[4]=addr "Copy", tips[8]=addr "Paste"...
Posted on 2002-06-27 15:02:30 by gfalen