windows shutdown notification



Is there any way to make MFC application being notified at windows
shutdown event.
I have tried WM_QUERYWNDSESSION message but it didn't help.
Can anybody send me code to do that??
.