Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How can I pass a struct (like RECT) to an API function?
Message
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00172163
Message ID:
00172182
Views:
21
Cristof,

You have to be very careful when attempting to use builtin properties like Top and Left of custom classes. I don't remember the exact circumstances, but VFP has a way of usurping those properties internally and screwing up the values you have put there.

>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
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform