Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > .NET General

Vista - Create Windows service that captures shutdown.

Reply
 
Old 04-03-2008   #1 (permalink)
John


 
 

Create Windows service that captures shutdown.

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.

My System SpecsSystem Spec
Old 04-07-2008   #2 (permalink)
Chris


 
 

RE: Create Windows service that captures shutdown.

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

Thanks

"John" wrote:
Quote:

> 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.
>
My System SpecsSystem Spec
Old 04-07-2008   #3 (permalink)
John


 
 

Re: Create Windows service that captures shutdown.

Chris wrote:
Quote:

> Hi,
> You might want to look into WMI. Might be a place to start.
>
> Thanks
>
> "John" wrote:
>
Quote:

>> 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.
>>
Hi,

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

Thanks for the pointer.

Regards,

John.
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Request for Microsoft to create Service Pack specific newsgroup for Vista Vista installation & setup
Quick Tip: Create Shutdown / Restart / Lock Icons in Windows Vista Vista General
Snipping Tool bad captures...Look at Pics Vista General
Screen Captures Vista General


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46