Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to pass char * from a dll to VFP5
Message
From
08/08/1998 20:10:35
 
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00125064
Message ID:
00125078
Views:
12
>extern "C" __declspec(dllexport) int cname(char *pCname)
>{
> CString Cname( "long test now ");
> pCname= new char[Cname.GetLength()+1];
> strcpy(pCname,Cname);
>
>return 0; // based on previous operations Ok/not
>}

Don't allocate memory to the string in the cname function. You must allocate the necessary space in VFP (ie initialiaze the string in VFP long enough) and pass the string by reference form VFP.

>DECLARE INTEGER Cname IN "xxx.dll" STRING @ NAMES

The DLL function names are case sesitive. So:

DECLARE INTEGER cname IN "xxx.dll" STRING @ NAMES

To use it:

lcNames = space(100) && it must be long enough
lnAnInteger = cname(@lcNames)

Vlad
Previous
Reply
Map
View

Click here to load this message in the networking platform