나는 Windows Forms 응용 프로그램을 C# .net 4.0에서 개발 중입니다. Windows 로그 오프 이벤트를 캡처하고 싶습니다.SystemEvents.SessionEnding not firing
public Form1()
{
InitializeComponent();
SystemEvents.SessionEnding += (s, e) =>
{
if (e.Reason == SessionEndReasons.Logoff)
{
MessageBox.Show("LogOff");
}
else if (e.Reason == SessionEndReasons.SystemShutdown)
{
MessageBox.Show("ShutDown");
}
};
}
왜 sessionEnding 발사 밤은 : 여기
코드인가?