Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to use Variant to pass array from C++ client to VFP
Message
De
02/04/2011 00:02:24
 
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows 7
Network:
Windows 2003 Server
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01505541
Message ID:
01505859
Vues:
52
If you can tell me, why you should use array for that purpose?
In C/C++, a string is array of char, you can pass a string pointer from C/C++ to parameter.
FUNCTION your_ole_func(tcBuffer AS STRING @) AS any
  ...
ENDFUNC


*!* this is calling from vfp
lcBuffer = REPLICATE(CHR(0), lnSize)
your_ole_func(@lcBuffer)

DIMENSION laBuffer[ lnSize ]
FOR i = 1 TO lnSize
  laBuffer[ i ] = SUBSTR(lcBuffer, i, 1)
ENDFOR


*!* this is calling from C/C++
char *cBuffer = malloc(..
your_ole_func(cBuffer);

for( i = 0; i < nSize; i++) {
  ... = cBuffer[ i ];
}
I didn't test it, I hope that correct and solve your problem.
Regards,
Ony
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform