Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Interfacing C DLL with Fox.
Message
 
To
22/09/1998 16:54:51
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00139024
Message ID:
00139731
Views:
39
Hi Paul,

>Ok, this is VFP code, but you're using some Win32 API functions to make it work.

I confess. :)

And no, I don't want to talk about if these API functions are VFP or not. :)

Well, they are, they are not, they are, they are not, they....

>What is not possible (or, correctly said, I don't know how to do it only with VFP, with or without API functions): If the pointer in the structure is set by the dll function, how do you read the memory area pointed by that pointer? (No C/C++ allowed :)).

No problem. < g > It works in VFP, but it's slow and ugly, I used a FLL for this. Anyway, the idea is similar to the code I posted. Thanks god, lstrcpy() is a Windows API function (Does anyone use it in C code?). SO you get back the adress as a string, since it's part of the structure. Convert it into an integer and use lstrcpy( cString, nAdress ) to copy the memory block into a string that should be long enough to hold the result.

It's getting more difficult if the pointer points to a structure that contains 0x00 values, here lstrcpy() would stop. So you check for the position of CHR(0) and if it's inside the structure you use lstrcpy() again, but starting at the next byte after that position. And so on, until you read the entire structure. Could take a while for large structures.

Never have tried this in practice, since I found it easier to use a FLL. But it should work, don't you think?

BTW, if the VFP API is allowed, there's a function to copy memory, unfortunately it's not included into FoxTools, that would make it even easier.


Christof
--
Christof
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform