Microsoft.Win32.SystemEvents.SessionEnding += new Microsoft.Win32.SessionEndingEventHandler(SystemEvents_SessionEnding);
protected override void WndProc(ref Message m) { const int WM_QUERYENDSESSION = 0x011; const int WM_ENDSESSION = 0x16; if (m.Msg == WM_QUERYENDSESSION) { } else if (m.Msg == WM_ENDSESSION) { } base.WndProc(ref m); }
this.FormClosing += new FormClosingEventHandler(frmMain_FormClosing);