How can my application determine when the system is shutting down?

Q

QuantumKid

I am currently developing a taskbar-icon based program
which normally has no open windows. I understand that
there is a Microsoft.Win32 event that is supposed to
notify the application, but this event fails to fire when
the computer is shut down. I have Windows XP. By not
knowing when the computer is shutting down, my
application stays in memeory when the computer tries to
shut down, so all proccesess except the app close. To
avoid this, you must manually close the program before
shutting down the computer. I hope that I can find a way
to make my program more user-friendly in this respect. I
would apprectate any information on this subject.
 
S

Stoitcho Goutsev \(100\) [C# MVP]

Hi QuantumKid,

Take a look at SystemEvents class declared in Microsoft.Win32 namespace.
It has events like SessionEnding, SessionEnded which you can catch and deal
with.
 

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