Cannot quit Visual FoxPro
The 'Cannot Quit Visual FoxPro' message must be one of the most common
problems you meet when starting to work with Visual FoxPro.
It has been with us since the launch of Visual FoxPro but the problem
still causes difficulties. The error message does not give an error number
so you cannot find it in the Help system. Help returns nothing if you
search for 'Cannot Quit Visual FoxPro' and MSDN is equally unhelpful. A
search on Google though will show you that it's a very common question in
all the support forums so it's disappointing that Microsoft have not added
it to Help.
Especially as it is a very simple problem to fix.
Close the application
The first thing to do is to close the application that has locked. The
least damaging way of doing this is to use the Windows Task Manager. In
Windows 2000 and Windows XP you can open the Task Manager by pressing
or by right-clicking on the Windows status bar. Select
from the options that appear then click the
on the Task Manager dialog:
Select your Visual FoxPro application from the list then click the
button. You will be warned that this is an extreme act and asked to
confirm that you do indeed want to cancel this process. Click
and wait. Windows may take several seconds to complete the task of closing
down the application. When it has been closed you will be told that you
have terminated FoxPro prematurely and asked whether you want to report the
problem to Microsoft. We have been reporting this for ten years now
so I suspect it will be a waste of time to report it again.
Now that you have cancelled the application, close the Task Manager and
open your project in FoxPro.
Solution
The problem arises because Visual FoxPro is event-driven. The RunTime
engine opens your executable and then responds to events as they occur.
You have closed your application but not told FoxPro to stop waiting
for events.
The command to stop the event-processing loop is:
Clear Events
and FoxPro must execute this command whichever way that the application
closes down. Depending on the structure of your application you might put
the command is several different places:
-
In the procedure called by the option
on the menu.
-
In the Click event of the button that closes your main form.
-
When the application shuts down:
On Shutdown Clear Events
FoxPro executable flashes on screen and vanishes
The other problem you'll hit with the FoxPro event-processing loop
is when you find that your executable won't run outside of the
development environment. You just see a flash of your main form on
screen before the executable closes. More details
here
.
|