Yet another question :D

DAYS db "Today is Monday"
db "Today is Tuesday"
db "Today is Wednesday"
db "Today is Thursday"
db "Today is Friday",0

How does one index the array. Just for example, today is Tuesday, so I want to pop up box saying "Today is Tuesday". how do I index that location

invoke MessageBox, NULL, ADDR DAYS, SIZEOF DAYS, MB_OK

I know this doesnt work , but I hope it illustrates what I want to achieve :)



As always, many many respects and thanks in advance
:alright:

Sidenote : Hiroshimator, where did the cat avatar come from ? It is the most awesomely fluffy looking thing ! aahahaha
Posted on 2002-01-28 23:21:57 by prana
TTT

I wonder if you can do this
invoke MessageBox, NULL, ADDR DAYS(2), SIZEOF DAYS, MB_OK

nope. doesnt like it...

hehehehe you see why I cant figure it out ? HEEEEEELLLPPP MEEEE PLZZZZZZZZZZZ hehheeheheh (sorry, just wanted to be silly)
Posted on 2002-01-29 00:19:57 by prana
Here is a start:
DAYS dd cTEXT(<Today is Monday>),

cTEXT(<Today is Tuesday>),cTEXT(<Today is Wednesday>),
cTEXT(<Today is Thursday>),cTEXT(<Today is Friday>)

mov ecx,What_Day_It_Is
invoke MessageBox,0, DAYS[ecx*4], DAYS[ecx*4], MB_OK
But this magic requires this macro: ;)
cTEXT MACRO y

LOCAL sym
CONST segment dword public 'DATA'
IFIDNI <y>,<"">
sym db 0
ELSE
sym db y,0
ENDIF
CONST ends
EXITM <OFFSET sym>
ENDM
Sorry, let me post something like what the code above generates:
_mon db "Today is Monday",0

_tue db "Today is Tuesday",0
_wed db "Today is Wednesday",0
_thu db "Today is Thursday",0
_fri db "Today is Friday",0

; array of pointers to our strings
DAYS dd offset _mon, offset _tue, offset _wed, offset _thu, offset _fri

; index into array (valid range = [0 - 4])
mov ecx,What_Day_It_Is
; multiply by size of array items
invoke MessageBox,0, DAYS[ecx*4], DAYS[ecx*4], MB_OK
Posted on 2002-01-29 00:59:08 by bitRAKE