Hi,
I need my console application to execute a last command when a user logout or shutdown windows.
Is there a way to catch those events or is there a specific event when windows try to close your application (you logout => windows want to close everything including your app). I found such thing for a windows form but not for a console application ...
Thanks for your help.
N.

[Console Application] Event when user logout/shutdown windows?
Grayson Peddie
I've been looking at this and it doesn't seem possible.
I tried getting various process info, but that doesn't work. And Jared's link specifically says:
Console applications do not raise the SessionEnding event.
There doesn't seem to be a way to "see" a console app close unless it happens via the app's own code.
kcon
thanks for your answer !
You confirm what i found ... ><
i'll guess i'll try with a window application !
Ron Luebke
Try looking at SystemEvents.SessionEnding
http://msdn2.microsoft.com/en-us/library/microsoft.win32.systemevents.sessionending.aspx