Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Simple EXE does not Shutdown correctly

Status
Not open for further replies.

SqueakinSweep

Programmer
Jun 20, 2002
945
GB
I have a very simple fox app, which is used to generate bar codes. It consists of one form only. The form has ShowWindow set to 2 (Top Level Form). When the exit button is clicked the application closes ok, but quite often leaves itself in the Task List. It also uses an ActiveX control for the printing of the labels, which I create an instance of and hold in a form property THISFORM.oActiveX

I have the following code in a runner prg to start the app
Code:
close all
on shutdown quit
set status bar off
set echo off
set talk off
set deleted on
set safety off
set carry off
set date british

application.visible=.f.

do form labels
read events

do quitprg

And this code in QuitPrg
Code:
clear events
close all
set status bar on
quit

And the exit button has the follwing code behind. I had to rem out the ActiveX dispose code, as it caused errors
Code:
*--Remove the ActiveX Object
*!*	IF TYPE(THISFORM.oActiveX)="O" 
*!*		THISFORM.oActiveX.Quit()
*!*		THISFORM.oActiveX=.F.
*!*	ENDIF
THISFORM.RELEASE

Anyone have any ideas how to dispose of everything properly?



Sweep
...if it works dont mess with it
 
Maybe I'm missing something here, but it looks like you only have thisform.release in the click event of the exit button. If you want to exit the app completely you need to use the quit command.

-Kevin
 
KDavie

QUITPRG runs after clicking the Exit button


Sweep
...if it works dont mess with it
 
Sweep,

I agree with Kevin. If the user clicks the Exit button, you will release the form, but the application will still be running (but invisibly). You need to issue CLEAR EVENTS as well, so that the main program will close down.

Mike


Mike Lewis
Edinburgh, Scotland

My Visual Foxpro web site: My Crystal Reports web site:
 
Doesn't QUITPRG contain both, CLEAR EVENTS and QUIT ? The one that is called at the end of the main program.

I guess, the question is, whether it ever gets to run. Try to step into it.
 
Thanks Mike/Kevin
Will try your suggestions.

Sweep
...if it works dont mess with it
 
Hi Sweep,

I use CLEAR EVENTS in the Destroy event of my main form and have never had a problem.

Regards,

Mike
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top