X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f From: Jason Hood Newsgroups: comp.os.msdos.djgpp Subject: Re: detecting process termination Date: Thu, 28 Oct 2004 03:07:24 +1000 Lines: 26 Message-ID: <417FD5CC.EAFAB927@yahoo.com.au> References: <2u9j4kF27tti9U2 AT uni-berlin DOT de> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: news.uni-berlin.de SBigZw4RiCaGq1i7S2JMFQ8eNLcPCcau6V+4XeNfgOrN55RyMW X-Mailer: Mozilla 4.8 [en] (Windows NT 5.0; U) X-Accept-Language: en,pdf To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Hans-Bernhard Broeker wrote: > > rafael-_no-spam_- AT _-please-_geninfor DOT com wrote: > > I would like to detect when the user clic on the X button to close the > > process in which is running my program under Windows. > > > I thought it could be possible using signal() but I see SIGKILL and > > SIGTERM are "currently unused". > > > żIs there any chance to know the program end is coming? > > Not the one induced by the Windows 'X' button: that one kills your > virtual DOS machine ("VDM"), i.e. it doesn't even try to talk to your > running DOS program. That's why you get a warning dialog if you use > it ("Windows cannot shut down this program...") in essentially all > situations but one: when command.com is idling on the command line > (sometimes it takes a 'cls' for Windows to recognize this state). Actually, you should be able to use the "close awareness" functions to recognise the 'X' button. Check out RBIL[1], Int2F/AX=168F. Not sure if they work on the NT family, but they do work in 9X (I needed them in CmdEdit to enable COMMAND.COM to close). [1] Ralf Brown's Interrupt List Jason.