Microsoft
Software
Hardware
Network
Question : Error "Cannot Quit Visual FoxPro" when closing form with embedded OLE MapPoint control
I have a Visual FoxPro 9 form with an embedded OLE MapPoint 2006 control. Sometimes after launching this form in my main app, closing, then closing the main app, I will get a "Cannot Quit Visual FoxPro" error, and the app will need to be forcibly closed with the task manager. The vast majority of the time this does not happen, but I have been unable to determine what specific circumstances lead to it happening. Our application allows for saved form layouts (which determine size, some saved settings, etc). Only one of my saved layouts will cause this error, while none of the others do, even though they're all launching the exact same form with the same initial parameters (the layout's settings only get applied after init).
I have done a lot of research on this error, and found lots of cases of people fixing it by clearing/releasing elements upon closing the app. Every non-local variable used in the app's execution is RELEASE'd, and the OLE map is calling its CloseMap() method on the close of the form. I have also tried doing all of the following on the close of the application itself to no avail (the app being closed with either CANCEL or QUIT with the same results):
CLOSE ALL
CLEAR ALL
CLEAR EVENTS
CLEAR RESOURCES
CLEAR DLLS
CLEAR PROGRAM
RELEASE ALL
RELEASE ALL EXTENDED
TABLEREVERT
ROLLBACK
END TRANSACTION
I have also tried killing the app with:
Declare ExitThread in Win32API
ExitThread()
but this only seems to hide the app, it's still running when I look in task manager.
Here's where I gets weird. Originally, this error would happen every single time I launched the form with the OLE map and closed the app. After much debugging, I discovered that I could prevent it by changing the TabIndex property of a listbox control on the form. Both the OLE map and the listbox had a TabIndex of 2, and apparently removing this "conflict" fixed the problem for me for every case except for when the form is launched via this one particular saved layout. This leads me to think that the error is being caused by a bug in Foxpro itself.
Does anyone have any ideas for a fix or even a workaround to prevent this error from happening?
Answer : Error "Cannot Quit Visual FoxPro" when closing form with embedded OLE MapPoint control
Try to add
ON SHUTDOWN QUIT
into your code.
Random Solutions
Need help with important safety precautions!
How to determine hard disk activities
Can't access Exchange 2003 OWA from Internet
Windows XP problems after a hard drive clone of a bad drive
Anyone get Quickbooks errors in the Windows App log but not the program? Intuit says normal
Gracefully shutting down VMs before ESX hosts shutdown in vSphere
SSAS 2008 MDX All Member Before Current Member
Installing public SSL for Exchange 2007 server
What is the Best Digital Camera, that is tiny, takes video and takes great pictures?
Vista DLLHOST.EXE Popup