Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to declare VB's TYPE STATEMENT in Foxpro?

Status
Not open for further replies.

AndHof

Technical User
Jan 19, 2001
3
SE
When looking into different API's, the syntax of writing codes are most often in Visual C or Visual Basic. One of my problems is how to understand how to write code in Foxpro where the parameter in the API function consists of more than one element. In Visual Basic there is the TYPE STATEMENT.
For example:
Private Type NETRESOURCE
dwScope As Long
dwType As Long
dwDisplayType As Long
dwUsage As Long
lpLocalName As String
lpRemoteName As String
lpComment As String
lpProvider As String
End Type

What is the syntax in the Foxpro language?
 
Hi!

In the VFP you require to prepare a string. Each character in the string is one byte. VFP string might contain any codes include chr(0). Put you structured data into the string and pass as parameter to API function that string. In DELARE DLL statement as parameter type use string as well.

When you require to return structure from the API function - do the same, but you require to initialize VFP string to some values of required length before API function call - just to shrink it to the required memory size. MyString = Space(<size of structure>+1) is enough.

Vlad Grynchyshyn
vgryn@softserve.lviv.ua
The professional level of programmer could be determined by level of stupidity of his/her bugs
 
Try on the UT ( - after you log on (registration is free), choose &quot;Files&quot;, then choose &quot;WIN32API &amp; others APIs&quot;, then down to &quot;API-Structures in VFP&quot; by Christof Lange (# 001070). This can handle structures of most every type.

Rick
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top