[Console Application] Event when user logout/shutdown windows?

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.



Answer this question

[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:

    Important:

    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

  • [Console Application] Event when user logout/shutdown windows?