Possible Duplicate:
How to detect whether Windows is shutting down or restarting
In c# I am able to find only whether windows is logging off or getting shutdown using below code.
SystemEvents.SessionEnding += new SessionEndingEventHandler(SystemEvents_SessionEnding);
static void SystemEvents_SessionEnding(object sender, SessionEndingEventArgs e)
{
switch (e.Reason)
{
case SessionEndReasons.Logoff:
break;
case SessionEndReasons.SystemShutdown:
break;
default:
break;
}
}
But I want to know how to capture windows re-start event in c#.?