Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VFP60- Translation
Message
 
To
11/06/1999 22:24:40
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00229079
Message ID:
00229353
Views:
19
>Where do I go to learn about those API functions? How do I translate from C to VFP? I see many of them in MSDN Library but I don't know how to use them in VFP. Can you recomend some books that I can buy? Can you give me some input where do I go to start with this?
>
>For instance, I just went to MSDN and found PROFILEINFO function. I would like to know how to TRANSLATE this to foxpro.
>
>typedef struct _PROFILEINFO {
> DWORD dwSize; // size of structure
> DWORD dwFlags; // flags
> LPTSTR lpUserName; // user name
> LPTSTR lpProfilePath; // roaming profile path
> LPTSTR lpDefaultPath; // default user profile path
> LPTSTR lpServerName; // validating domain controller name
> LPTSTR lpPolicyPath; // Windows NT 4.0-style policy file
> HANDLE hProfile; // registry key handle
>} PROFILEINFO, FAR * LPPROFILEINFO;
>
>Thank you for your time!

Calling API functions from VFP can be tricky. API functios are usually written in C and assume they will be called by C. VFP does not support structures and pointers, which are used in many API calls. You can simulate structures by passing a character string. A great tool for dealing with structures is Struct.zip by Arnon Gal-Oz in the Classes-VCX section of the UT File Library. Many pointer issues can be handled by Paul Vlad Tatavu's Pointer.zip in the WIN32 and Other API's section.

Take a look in UT Knowledge Base - Frequently Asked Questions - Win32 API section for examples of how various API's are called from VFP.

The main trick is to translate C data types into the VFP equivalent types supported by the VFP DECLARE DLL command. In your example DWORD = INTEGER, LPSTR = STRING@, HANDLE = INTEGER. However since this is a structure you would need to combine everything into one string to pass it to the API. Also the example you show is not an API function. It is just the structure declaration that would be used by an API function.

API functions are case sensitive. Make sure you type the API name exactly.

A good reference for Windows API is "Windows NT WIN32 API Superbible" by Richard J. Simon ISBN 1-57169-089-1
Steve Ruhl
CitiMortgage, Inc.
steven.ruhl@citibank.com Office
Steve@steven-ruhl.com Home
Previous
Reply
Map
View

Click here to load this message in the networking platform