Create Windows service that captures shutdown.

J

John

Hi,

as title suggests, I want to create a windows service that can be
notified that the computer is shutting down. When it receives this
signal it needs to block for about 10 seconds to write some stuff to a
file before allowing the machine to continue with shutdown (or possible
stop the shutdown if there was an error so that the user can be informed)

I am using Visual Studio.NET 2003 and used the windows service template
that it provided. I see that the template has a 'CanShutdown' property
which means that it should get the shutdown signal when it is
terminating but I don't this this will be anygood for cancelling the
shutdown if need be.

Does anyone know if there is a way to cancel the shutdown without having
to create a window and capturing the WM_QUERYENDSESSION message?

Regards,

John.
 
J

John

Chris said:
Hi,
You might want to look into WMI. Might be a place to start.

Thanks

Hi,

WMI looks very useful indeed. I think I've got a alot of reading to do now.

Thanks for the pointer.

Regards,

John.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top