Hi all my friends,
What are you trying to do, by some how, can fit in the Callback category. Some modern API functions require a function pointer or an object pointer to be passed to them as an argument, so the calling program can respond to some messages from the API, handling some events raised by the API is common use, so the API will raise the event and your program will catch it in the function you passed its address to the API and handle it however you see fit.
Some VB programmers may argue , why going in circles, I will just declare it WITH EVENTS (which we can’t do in VFP). The answer is no you can’t. It is crucial to understand that APIs DLL is not a COM-based.
It means it is not an object and it has no PEMs interface you can communicate with. It is a standard DLL which unlike COM-based DLLs you can’t develop them in VB or VFP. From here the designers of APIs came up with this mechanism CALLBACK. Search MSDN fro Callback for more information.
VB as you know support this mechanism either by ADDRESSOF operator or AS OBJECT. On the other hand, according to Microsoft, unfortunately VFP has no native way to support this mechanism. In the most basic level the reason for that is VFP’s handling of messages is non standard, So if you want to pass a complex structure to API you are in trouble (not to mention pointer to an object), Sorry for carrying these bad news for you.
The good news are, we live in the COM world. So it may worth it to consider developing this component with VB and compile it as a COM server, then instantiate it from VFP
Thanks
Walid Magd
Engwam@hotmail.com