TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Laurence Lane
from: Peter Fitzsimmons
date: 1996-03-29 14:50:08
subject: shutdown

LL> I'm using one textmode app that manages an orderly 
 LL> shut down when I kill it from the command line 
 LL> (GO.EXE), Windows List, or control box (the box in the 
 LL> upper left corner, not sure of the term).  Other 
 LL> programs just behave as if someone yanked a chair out 
 LL> from under them.

 LL> Please point me to any info on doing an orderly 
 LL> shutdown in the above sceneio.

Every type of os/2 program will always receive a XCPT_PROCESS_TERMINATE
exception (see DosSetExceptionHandler).  If you intercept the exception,you
can do so processing (or even reject the exception if you want to be
immortal).  

There are also exit-lists,  one of my fav's.  You can't prevent death from
one,  but you can control the order over which various exit lists are
performed.  The easiest way to handle this,  with a C compiler,  is to use
the onexit() or atexit() function.

A PM program will received a WM_QUIT message on any queue it has not run
WinCancelShutdown() on,  when you try to close it from the WindowList,or
from the program's SystemMenu.  I don't think it will receive this message
if you kill it from the command line (DosKillProcess),  in which case
you'll have to rely on the exception handler,  or an exit-list routine --
but your hwnd's might have been destroyed by this point, so what you are
trying to clean up may be important.

So -- it really depends on what type of program you are talking about,and
what type of cleanup you need to do.


--- Maximus/2 3.00
* Origin: Sol 3 * Toronto * V.32 * (905)858-8488 (1:259/414)
SEEN-BY: 50/99 78/0 270/101 620/243 711/401 409 410 413 430 808 809 934 955
SEEN-BY: 712/407 515 517 628 713/888 800/1 7877/2809
@PATH: 259/414 400 99 250/99 3615/50 396/1 270/101 712/515 711/808 809 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.