Newsgroups : Borland : borland.public.delphi.nativeapi.win32 : 2006 Nov : Detecting windows shutdown from service

www.cryer.info
Managed Newsgroup Archive

Detecting windows shutdown from service

Subject:Detecting windows shutdown from service
Posted by:"David" (n..@nil.nil)
Date:1 Nov 2006 02:21:23

Hello.

I want my service application to take different actions depending
on whether the service is stopped in a normal way (i e, using
"net stop" or from the service manager), or if it is being
stopped due to a windows shutdown.

Since it is a service, I cannot count on any WM_QUERYENDSESSION messages. I also tried setting a ConsoleCtrlHandler, but it does
not always seem to work (I'm probably receiving the stop request before the console event, or I'm doing something wrong...).

I am also curious about what the difference of a "service stop" and a "service shutdown" is (if any), and if it is related to this problem.

Thankful for help,
// David

Replies:

www.cryer.info
Managed Newsgroup Archive