1

I am trying to capture windows 10 restart/shutdown events using C# winforms. I am writing an application that requires the complete log of idle time, lock/unlock and windows restart/shutdown/logoff timestamps.

Can you help me in guiding with related links or posts, Thank you

Santosh_Sams
  • 207
  • 1
  • 2
  • 10

1 Answers1

0

Attach an event handler method to the SystemEvents.SessionEnding event, and your handler method will be called each time the event is raised. Handling this event will allow you to cancel the pending log off or shut down.

Sam Huang
  • 99
  • 1
  • 7