Cannot Quit from VFP Automation...  
Author Message
Michael S.





PostPosted: Visual FoxPro General, Cannot Quit from VFP Automation... Top

Hi,

When running the below vb script with the command line

cscript testvfp.vbs

I receive an error dialog from VFP saying "Cannot Quit Visual FoxPro" and the VFP de**** is started.

Any ideas was is wrong

It does output the path as "c.\windows\system32".

Thanks in advance for any replies,
/Michael

' testvfp.vbs file

Dim oFox ' As Object
Set oFox = CreateObject("VisualFoxPro.Application")

WScript.Echo oFox.DefaultFilePath

oFox.Quit
Set oFox = Nothing




Visual FoxPro1  
 
 
Vedat ARAL





PostPosted: Visual FoxPro General, Cannot Quit from VFP Automation... Top

Try this

Dim oFox ' As Object
Set oFox = CreateObject("VisualFoxPro.Application")

WScript.Echo oFox.DefaultFilePath
oFox.DoCmd("CLEAR EVENTS")
oFox.Quit
Set oFox = Nothing


Vedat Aral

 
 
Tamar E. Granor





PostPosted: Visual FoxPro General, Cannot Quit from VFP Automation... Top

Do you have a start-up program for VFP that might be running something that's interfering with shutdown

Tamar

 
 
Michael S.





PostPosted: Visual FoxPro General, Cannot Quit from VFP Automation... Top

Introducing the oFox.DoCmd("CLEAR EVENTS") didn't help.

To clarify, when the VFP de**** appears, an error message saying "OLE exception error: Exception code c0000005. OLE object may be corrupt" does also appear.



 
 
Dan Freeman





PostPosted: Visual FoxPro General, Cannot Quit from VFP Automation... Top

Set the task pane manager not to start automatically.

I get "Cannot Quit Visual Foxpro" when it's running. When I turn it off, VFP quits just fine.

 
 
SuperFox





PostPosted: Visual FoxPro General, Cannot Quit from VFP Automation... Top

This error message can be caused by some incorrect code in the FoxPro app. I would run the FoxPro app outside of the script and see if it closes properly. Even if it appears to close properly, check the task manager to see if it's actually running. This can be caused by the event loop not being exited (CLEAR EVENTS) or perhaps some objects were created that were not properly nulled before the app exits.

Hope this helps,

Greg Gum

Dallas Texas


 
 
AndyKr





PostPosted: Visual FoxPro General, Cannot Quit from VFP Automation... Top

>> I would run the FoxPro app outside of the script and see if it closes properly. Even if it appears to close properly, check the task manager to see if it's actually running.

I don't think an App is running. The posted code refers only to VFP itself:

Set oFox = CreateObject("VisualFoxPro.Application"

and DefaultFilePath is a native property of the VFP object.



 
 
Michael S.





PostPosted: Visual FoxPro General, Cannot Quit from VFP Automation... Top

Thanks, Dan

Your suggestion about turning off the task pane manager did it.

Wen't into the Task Pane Manager Options and unchecked the "Open the Task Pane Manager when Visual FoxPro starts."



 
 
SuperFox





PostPosted: Visual FoxPro General, Cannot Quit from VFP Automation... Top

Hi Andy,

That is true, but the point was that there may be some code which is leaving a dangling object which might be preventing it from closing properly. Running it on it's own, even if inside VFP, would make it easier to find it, don't you think

Greg


 
 
AndyKr





PostPosted: Visual FoxPro General, Cannot Quit from VFP Automation... Top

Hi Greg

>>but the point was that there may be some code which is leaving a dangling object which might be preventing it from closing properly. Running it on it's own, even if inside VFP, would make it easier to find it, don't you think

Yes, if he were running anything - but he's not. All he was doing was setting a property. I think Dan nailed it - the TaskPane manager was being started automatically by VFP when it was instantiated which is what was causing the problem.



 
 
Dan Freeman





PostPosted: Visual FoxPro General, Cannot Quit from VFP Automation... Top

>>I think Dan nailed it - the TaskPane manager was being started automatically by VFP when it was instantiated

Dang straignt. *gd&r*

It's mighty easy to forget that default startup modes for automation servers can affect what your code does. (i.e. Word starts without an open document, etc.) They other thing that will typically be forgotten when starting VFP is the default for SET EXCLUSIVE. How many of us change that setting moments after installing and forget that we've done it until it bites us the next time we install ;-)