Reputation:
We have a system which was built in Visual Foxpro (VFP6) but it is still functioning.
On the other hand, we have another system (in VB6) which processes daily business and we want this system to be able to DIRECTLY interact with the VFP6 program thru DLL call.
After some research, we've found that it is possible to build a DLL file from VFP6 and then our VB6 system can use DLL call to interact with the visual foxpro DLL (and then update the data in some "DBF" files).
We know the part to call DLL from our VB6 system like the following (a data insertion operation):
set newobject=CreateObject(DLLName, ClassName)
action1=newobject.insert(Data1, Data2, Data3)
But how can we build a DLL from VFP6 ? Anyone has experience please kinldy share.
Upvotes: 1
Views: 940
Reputation: 8043
You may follow the steps below to build DLL thru VFP6
In the Project Manager , Code > Programs, create a program and put the codes like this:
DEFINE CLASS newsdata AS CUSTOM OLEPUBLIC
PROCEDURE Insert
lparameters data1, data2, data3
workfolder=fullpath(curdir())
set defa to (workfolder)
use [dbfname]
[add all other VFP codes here, processing data1, data2, data3....if needed]
ENDPROC
ENDDEFINE
(please put additional methods into different PROCEDURE so that your calling program can use them)
After that, Please use "Build" and choose "Build COM DLL"
Then please place the DLL on your VB6 folder, and you can call this DLL by codes like
Set object1 = CreateObject([DLLname].[Classname])
Result = object1.Insert(Data1, Data2, Data3....)
Upvotes: 3