Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to pass char * from a dll to VFP5
Message
De
08/08/1998 20:10:35
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00125064
Message ID:
00125078
Vues:
11
>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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform