From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,53d6d1308be499e1 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-10-22 07:56:03 PST Path: archiver1.google.com!news2.google.com!news.maxwell.syr.edu!sjc-peer.news.verio.net!news.verio.net!iad-read.news.verio.net.POSTED!not-for-mail From: "Dmitry Shykhman" Newsgroups: comp.lang.ada References: Subject: Re: Gracefully detecting program termination. X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 X-NNTP-Posting-Host: 192.117.112.241 Message-ID: Date: Wed, 22 Oct 2003 16:54:27 +0200 NNTP-Posting-Host: 192.114.47.10 X-Complaints-To: abuse@verio.net X-Trace: iad-read.news.verio.net 1066834557 192.114.47.10 (Wed, 22 Oct 2003 14:55:57 GMT) NNTP-Posting-Date: Wed, 22 Oct 2003 14:55:57 GMT Organization: Verio Xref: archiver1.google.com comp.lang.ada:1423 Date: 2003-10-22T16:54:27+02:00 List-Id: "Jano" wrote in message news:MPG.19ffcb3643db1f8989776@News.CIS.DFN.DE... > I have a program that runs under Win32 and Linux. It's a daemon-like > tool, so it is launched on startup and runs until system goes down. > > Now I'm interested in it detecting when the shutdown is happening to > save some data and do a graceful ending. > > In Linux I think it suffices to trap SIGTERM and company. In Windows > I've seen that I could catch Ctrl-C that way but not a system shutdown. > Try to check WM_QUERYENDSESSION message