In an effort to bridge gaping VFP and VB, specially nowadays it sounds like we (VFP programmers) will need to use VB as a COM builder to be able to support some functionalities VFP doesn’t support natively. I will start this thread to explain one of the major deference between the two tools, I don’t know if what I am doing ( Taking a thread and post it in this aria) is consistent with the site policy or not ). If not sorry for that (I'm new to the forum)please feel free to correct me.
On Feb 1,2001 Leonelsanchezjr asked
I AM TRYING TO CONVERT THE FOLLOWIGN VISUAL BASIC SYNTAX TO VFP6.0:
Declare Function CreateFieldDefFile Lib "p2smon.dll"(lpunk As Object, ByVal filename As String, ByVal bOverWriteExistingFile As Long) As Long
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
On Feb 1,2001 Leonelsanchezjr asked
I AM TRYING TO CONVERT THE FOLLOWIGN VISUAL BASIC SYNTAX TO VFP6.0:
Declare Function CreateFieldDefFile Lib "p2smon.dll"(lpunk As Object, ByVal filename As String, ByVal bOverWriteExistingFile As Long) As Long
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