OLE Automation with FoxPro

Is there a way to implement OLE Automation on a second instance of VFP.  I can get a handle of the second instance, but how can I pass a reference between the two so that the OLE Automation hierarchy is available to access.  

As an example, Excel can be accessed via ->    x = CreateObject("Excel.Application")  of via the GetObject(,"Excel.Application")  command if Excel is open.

What would be the syntax for accessing a second instance of VFP?

Who is Participating?
oFox = CREATEOBJECT("VisualFoxPro.Application")
? oFox.Version
? oFox.Eval("version()")
oFox = NULL

dataliteAuthor Commented:
Thank you both for the solution.  Strangely enough I tried that, but I must have misspelled it.  It does work, but it creates a new instance of foxpro.  What I was looking for was the GETOBJECT(,"VisualFoxPro,Application"), which latches on to an existing instance of Foxpro.

But your solutions led me to it and I thank you for your kind help.

I will therefore split the total between the two of you...


dataliteAuthor Commented:
Ha ha ha...  It was just one person...  I did not read the names on the posts....
pcelba  Hope you got all 500 points...

You may also use _VFP system variable instead of GETOBJECT to obtain OLE reference to current VFP process.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.