Hi,
How would use one structure within another? this doesnt work

struc POINT x,y
{
.x dw x+0
.y dw y+0
}

struc MSG hwnd,message,wParam,lParam,time,pt
{
hwnd dw hwnd+0
message dw message+0
wParam dw wParam+0
lParam dw lParam+0
time dw time+0
pt POINT <------------- or POINT <> either
}
Would be great if someone could help me thanx.
Posted on 2003-01-01 10:25:21 by keyoke
You get the error because "pt" label is used as the macro argument, and when you don't provide this argument to "MSG" macro, it has empty value, so "pt POINT" becomes "POINT" and this instruciton is not recognized (because there's no standard macro of that name, only the structure macro, which need a label).
Here's the correct version:


struc POINT x,y
{
.x dw x+0
.y dw y+0
}

struc MSG hwnd,message,wParam,lParam,time,pt
{
.hwnd dw hwnd+0
.message dw message+0
.wParam dw wParam+0
.lParam dw lParam+0
.time dw time+0
.pt POINT pt
}
Posted on 2003-01-01 10:31:12 by Tomasz Grysztar
hehe i shouldve seen that thanks for the help
Posted on 2003-01-01 11:01:59 by keyoke
Hi Privalov,
could u help me with just these two questions...


HWND TYPEDEF DWORD
does this work for fasm? i didnt see typedef in the text.because i get an error when using it in my code eg

hwnd HWND

and is there a SIZEOF macro that can be used or must i just use this

struc WNDCLASSEX style,lpfnWndProc,cbClsExtra,\
cbWndExtra,hInstance,hIcon,hCursor,\
hbrBackground,lpszMenuName,hIconSm,cbSize
{
.style dw style+0
.lpfnWndProc dw lpfnWndProc+0
.cbClsExtra dw cbClsExtra+0
.cbWndExtra dw cbWndExtra+0
.hInstance dw hInstance+0
.hIcon dw hIcon+0
.hCursor dw hCursor+0
.hbrBackground dw hbrBackground+0
.lpszMenuName dw lpszMenuName+0
.lpszClassName dw lpszClassName+0
.hIconSm dw hIconSm+0
.cbSize = $-.style
}
will this work?

thanks 4 your help
Posted on 2003-01-01 12:01:40 by keyoke
ASM is quite different from C/C++. For all windows variables (HWND, and all that other stuff) just use dd....example

hwnd dd 0 ; that works......

I'm not sure but I think you have to use the $-.firstvar thing...
Posted on 2003-01-01 12:49:57 by CyberGuy