News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Question about declarations

Started by brixton, June 13, 2005, 07:54:01 AM

Previous topic - Next topic

brixton

When I see these variables being declared in a Proc, I wonder how they would be declared if they weren't in a proc.

For example,

      LOCAL wc   :WNDCLASSEX
      LOCAL msg  :MSG
      LOCAL Wwd  :DWORD


How can you declare a MSG structure in the .data or .data? section, or how do you declare a variable of type WNDCLASSEX?

I don't understand, thanks for any help  :red
If you love somebody, set them free.
If they return, they were always yours. If they don't, they never were..

Jeff

quite simply:
.DATA
wc WNDCLASSEX <>
msg MSG <>


when initializing structures, you need to use angle brackets.  when you leave the brackets alone, the structure will take the default values for that structure.  otherwise, you can pass in the values for each field.  so for instance, if you wanted a COORD structure with X = 2 and Y = 3:
.DATA
pt COORD <2,3>

(remember, order matters)

thomas_remkus

Is the ordinal placement of array members between your &gt; and &lt; directly related to the way that it is written in the .inc or declared location?

thomas

RuiLoureiro

Hi brixton
             These structures (and many others) are defined in windows.inc ( if not wrong )
WNDCLASSEX
 MSG


So, you can use it to define variables in .data or .data? section like the exmple from Jeff
or in the stack with LOCAL

Does it help ?
Rui

MichaelW

Thomas,

If I understand your question correctly, the answer is yes. See Structures and Unions here:

http://webster.cs.ucr.edu/Page_TechDocs/MASMDoc/ProgrammersGuide/Chap_05.htm

eschew obfuscation

brixton

Many thanks for the help, yet again  :U

Now I will practise using STRUCTs  :green
If you love somebody, set them free.
If they return, they were always yours. If they don't, they never were..

thomas_remkus

MichaelW,

You did a great job understanding what I was asking. Phew! Thanks, that did answer my question perfectly ... and I have another help reference too! Thanks for that!!

I now understand that MASM like C, the ordinal positions of structured variables plays an important part in initializing them. I also now understand more about C.

thomas