I started to port over some code from Masm to Fasm and ran across
a snag. Maybe someone would like to straighten out my code :tongue:

In Windows.inc:


struc TBBUTTON
{
.iBitmap dd ?
.idCommand dd ?
.fsState db ?
.fsStyle db ?
._wPad1 dw ?
.dwData dd ?
.iString dd ?
.size = $-.iBitmap
}


in .data section:
hButton TBBUTTON

in my main callback proc under WM_CREATE I have this line to make a toolbar:
call CreateToolbarEx, ,\
WS_VISIBLE or WS_CLIPCHILDREN or TBSTYLE_FLAT or CCS_ADJUSTABLE,\
1000, 0, 0, 0, 0, 0, 16, 16, 0, 0, dword

(call is overloaded, same as invoke macro)

The problem (after some debugging) seems to with hButton.size. I *thought*
"dword " per the definition in my inc file should return a 20. When
I compile and run I get the nasty "This program has performed an illegal operation"
error and it aborts. If I change this to "hButton.size" it runs fine, but I thought
without the brackets this would be a memory address... In addition if I sub in the
immediate value of 20 it also runs.

Is there something fishy about the way I defined it? Or called it?
Thanks!
Posted on 2002-07-25 21:56:54 by Graebel
There is no memory address "hButton.size" - it is an immediate value as you have defined it in the structure. would be the data at the memory location defined by the value of hButton.size - which is a 20.
Posted on 2002-07-25 22:26:23 by bitRAKE
Ahhh, so thats whats going on. I had assumed, since size has the dot notation,
that it was simply an extra member of the structure that was being added on at
the end. Since I made that assumption I was trying to get the contents at that
location :eek:

Hmmph, I can already tell that thats going to confuse the crud out of me. Im
just going to have to post some sticky notes around my monitor to remind me :alright:

Thanks bitRAKE =)
Posted on 2002-07-25 22:35:31 by Graebel