* Gracefully detecting program termination.
@ 2003-10-21 22:02 Jano
2003-10-22 14:54 ` Dmitry Shykhman
0 siblings, 1 reply; 3+ messages in thread
From: Jano @ 2003-10-21 22:02 UTC (permalink / raw)
Hello fellow Adagoers,
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.
I'm still in the process of investigating it so I haven't still reached
a dead end, but just in case someone is doing this already and can throw
me a quick pointer in the way to go...
Thanks!
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Gracefully detecting program termination.
2003-10-21 22:02 Gracefully detecting program termination Jano
@ 2003-10-22 14:54 ` Dmitry Shykhman
2003-10-22 19:00 ` Jano
0 siblings, 1 reply; 3+ messages in thread
From: Dmitry Shykhman @ 2003-10-22 14:54 UTC (permalink / raw)
"Jano" <nono@celes.unizar.es> 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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Gracefully detecting program termination.
2003-10-22 14:54 ` Dmitry Shykhman
@ 2003-10-22 19:00 ` Jano
0 siblings, 0 replies; 3+ messages in thread
From: Jano @ 2003-10-22 19:00 UTC (permalink / raw)
Dmitry Shykhman dice...
> Try to check WM_QUERYENDSESSION message
That's OK for windows appz... anyways, I've found my way using
SetConsoleCtrlHandler.
Thanks!
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2003-10-22 19:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-10-21 22:02 Gracefully detecting program termination Jano
2003-10-22 14:54 ` Dmitry Shykhman
2003-10-22 19:00 ` Jano
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox