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
C++ : Avoid ambiguous copy constructor error
How to run app on local machine and display results in web page
VPN split tunneling not working on ASA5510
install server 2003 over win7
Cannot re-enable firewall with group policy
ASA 5505 DMZ won't Access Internet
Virtual Data Recovery Error
A critical function required for the transfer of delivery of the message was not supported by the originator of the report
Remove Old AD Computer Account via Command Line
Kernel panic not syncing VMWare Data Recovery 1.2