Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to use Variant to pass array from C++ client to VFP
Message
From
02/04/2011 00:02:24
 
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows 7
Network:
Windows 2003 Server
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01505541
Message ID:
01505859
Views:
51
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
Previous
Reply
Map
View

Click here to load this message in the networking platform