Detecting Windows Shutting down or User Logout



hi, I've a small systray app that is causing me some grief.

Is there a way to detect that either the current user is logging out, or if
windows is shutting down? A windows message perhaps??

Any help appreciated.

Roy.


.