I would like to reference the fields of a structure indirectly, for example, by loading ebx with the address of the structure, and then the field by, eg.,
mov ebx, OFFSET lpwin
mov edx, [ebx.wdt] or
mov edx, [ebx].wdt
These are the declarations:
lwstr STRUC ;Lfile Window STRucture
bkc DD ? ; 0 BacKground Color
txc DD ? ; 4 TeXt Color
hp DD ? ; 8 Horizontal Position
vp DD ? ;10 Vertical Position
hgt DD ? ;14 HeiGhT
wdt DD ? ;18 WiDTh
bad DD lwma ;1C Buffer ADdress LWMAin
lwstr ENDS
lpwin lwstr <4040, 0, 40, 20, 6, 10, dwbuf>
The MASM32 Reference implies that this can be done.
You must refer to structure members in the format
structurename.membername or with a pointer to a structure followed
by the .membername tag.
But the mov edx instructions above give "symbol undefined: wdt", while mov edx, [lpwin.wdt] works OK.
What am I doing wrong?
Thanks,
Robert
Add:
assume ebx:PTR lwstr
before you do the reference. Note that you'll have to 'assume nothing' when you want to use it for something else
-r
Robert,
Assume works fine, but even simpler is the syntax
mov eax, [ebx.RECT.left]
mov eax, [ebx.RECT.top]
etc
Thanks.
That works fine.
Quote from: jj2007 on January 02, 2010, 05:55:57 PM
Robert,
Assume works fine, but even simpler is the syntax
mov eax, [ebx.RECT.left]
mov eax, [ebx.RECT.top]
etc