BrendanChandler
Programmer
I have a VFP 6 application containing several databases of names and numbers to describe it in simplistic terms. A want to link this system to a new telephone system that is being installed so that as well as users clicking 'Find' in my app to locate records using name, telephone no etc, when the phone rings I want the 3rd party phone system to send my app a message to tell me the number which is ringing so that I can return the name of the person in the database to whom the phone number belongs (there could be several in some instances). The phone software should present a list of possibles and if the user selects one it will pass details back to my app so that I can locate the selected record and display the appropriate input screen.
The telephone people suggest COM is the best way but as usual cannot really help with VFP and I have done no VFP COM server stuff before now other than some automation stuff to control Word and Outlook.
I have worked out so far that I can put the following code at the end of my top level PRG file in my app
DEFINE class phonestuff AS CUSTOM OLEPUBLIC
PROCEDURE phonesearch
Parameters ptelephone
do ismess with "Some one just called on "+ptelephone
ENDPROC
ENDDEFINE
I compile the app as MYAPP.EXE, ran it and accessed the server from another VFP session using
oTest = CREATEOBJECT("myapp.phonestuff")
cName = oTest.phonesearch("1234")
It worked! I thought this is easy then the problems started - as I started to expand the code to interrogate the database in the app, load the appropriate forms etc I found that tables that are open throughout the app where not accessible to the com object, neither were forms or other classes that are present throughout the app.
Question - what do I need to do in order to make everything visible to the COM object that has already been loaded in MYAPP.EXE? Are there any more pitfalls I should be aware of as I take this development further?
Any help really appreciated. Thanks
The telephone people suggest COM is the best way but as usual cannot really help with VFP and I have done no VFP COM server stuff before now other than some automation stuff to control Word and Outlook.
I have worked out so far that I can put the following code at the end of my top level PRG file in my app
DEFINE class phonestuff AS CUSTOM OLEPUBLIC
PROCEDURE phonesearch
Parameters ptelephone
do ismess with "Some one just called on "+ptelephone
ENDPROC
ENDDEFINE
I compile the app as MYAPP.EXE, ran it and accessed the server from another VFP session using
oTest = CREATEOBJECT("myapp.phonestuff")
cName = oTest.phonesearch("1234")
It worked! I thought this is easy then the problems started - as I started to expand the code to interrogate the database in the app, load the appropriate forms etc I found that tables that are open throughout the app where not accessible to the com object, neither were forms or other classes that are present throughout the app.
Question - what do I need to do in order to make everything visible to the COM object that has already been loaded in MYAPP.EXE? Are there any more pitfalls I should be aware of as I take this development further?
Any help really appreciated. Thanks