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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How should I correctly close my app.

Status
Not open for further replies.

TinLegs

Programmer
Jan 14, 2003
100
NZ
How should I correctly close my program fully before RUNning my backup program (a separate *.exe)? The option to call the backup is disabled if a window is open so I don't need to close any open windows first. Using C6 - Legacy.

I had...

POST(Event:CloseDown)
RUN('backup.exe ')

This worked OK but the programs title bar would shimmer before calling the backup prg (XP SP2) which gave the impression something was not quite right.

I have since tried using...

RUN('backup.exe ')
HALT(0,)

This eliminates the shimmer and appears to work fine but is it a good method to use?
 
I'd try something like this:

Create a class, which is instantiated at the global level, calls it cHowTerminate

!--- at a global scope ---!
INCLUDE('ctHowTerminate.inc')
cHowTerminate ctHowTerminate

!--- when the user requests a backup --!
POST(Event:CloseDown)
cHowTerminate.Set_RunBackup(TRUE)

!--- inside of the ,CLASS,TYPE ---
ctHowTerminate.Destruct PROCEDURE
CODE
IF SELF.RunBackup
CHAIN('backup.exe')
END


HTH,
Mark Goldberg
 
Thanks Mark, but just one small point, please correct me if I am wrong but I understand the CHAIN() command does not work correctly with XP.
Regards, TinLegs
 
I wasn't aware of that....
Time to write a quick test...
I wrote a VERY simple program, and it worked just fine (tested on XP Pro SP 2)
Code:
 PROGRAM
 MAP
 END
 CODE
 MESSAGE('TestChain')
 CHAIN('Notepad')
 MESSAGE('TestChain End -- should never get here')

HTH,
Mark
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top