Hi Uri,
>I want to pass an LPRECT (long pointer to RECT struct) to an API function. What should I do? How can I fill in the values? How do I know how many bytes are needed for 32-bit LONG or 16-bit WORD data type?
You can do it either the hard way or the easy way. *g*
The hard way would be to convert the numbers to binary strings, concat them and pass the string by reference to the API function. The easy way would be a class that does this all for you. Mark Wilden and I wrote such a class some time ago. It's public domain and I could send you a copy if you want. When I find the time to finish the documentation I'll upload it to the library here.
With this struct component, the RECT struct would be implemented in VFP like this:
DEFINE CLASS RECT AS Struct
Left = 0
Top = 0
Right = 0
Bottom = 0
cMembers = "l:Left,l:Top,l:Right,l:Bottom"
ENDDEFINE
And you can use it like this:
oRect = NEWOBJECT("RECT")
LPRECT = oRect.GetString()
APIFunction(@LPRECT)
oRect.SetString(LPRECT)
? oRect.Left, oRect.Top, oRect.Right, oRect.Bottom
Christof
--
Christof