Cheers Phaelax
Notice in the above snippet that when the Pnt() and Rect() arrays are dimmed, there are no dimensions allocated, the arrays are initially empty.
In the example, the <ADD TO QUEUE> command was used for the 2 following reasons,
1 - the command creates element zero.
2 - the internal array pointers are automatically set to the element index number they create, in this case element zero.
This allows you to just type the array name without an index number in the bracket and the current array element will be accessed.
e.g.
Type UDT
varUDT as integer
EndType
`Create an empty array
Dim array() as UDT
`Adds next element which is zero
`Sets interal array pointer for array() to zero
Add To Queue array()
`the array dosen't need an index number for a value
`to be assigned or to be retrieved
array().varUDT = 10
print array().varUDT
You could also do it this way
Type UDT
varUDT as integer
EndType
`Create an array with 1 element in it
Dim array(1) as UDT
`You could do either of the following
indexChk = 0
if (indexChk = 0)
`Sets interal array pointer for array() to zero
Array Index To Queue array()
`the array doesn't need an index number for a value
`to be assigned or to be retrieved
array().varUDT = 10
print array().varUDT
else
array(0).varUDT = 10
print array(0).varUDT
endif
I have also been experimenting with the Array commands for dynamically increasing and shrinking arrays and lists so I'm used to using them now.
Quote: "So this will work as long as the UDT matches the exact structure the windows call looks for?"
As far as I know, yes, that should be the case. I've only done some basic stuff so far.
One possible flaw maybe if a C++ type structure contains other C++ structures, this could happen with DLL function calls with more complex parameters such as Window styles, callbacks, etc.
e.g.
Type PointInfo
x as integer
y as integer
EndType
Type RectInfo
left as integer
top as integer
right as integer
bottom as integer
EndType
Type MultiUDT
pnt as PointInfo
rect as RectInfo
EndType
Although, thinking about it, as long as the C++ structures are strictly adhered to and the DLL calls are executed correctly , there shouldn't be a problem.
Hope my explanations are clear, even though I know what I mean, I might not convey the info as clearly as I think I have.
I should be posting some other memory stuff later, more graphics based though. I just want to make sure that there are no silly bugs in the code before I post it.