I'm trying to detect the Windows LogOff or Shutdown in my WPF application. Can someone help?
xaml.cs
private static int WM_QUERYENDSESSION = 0x11;
private static bool systemShutdown = false;
public static event Microsoft.Win32.SessionEndingEventHandler SessionEnding;
protected virtual void WndProc(ref System.Windows.Forms.Message m)
{
if (m.Msg == WM_QUERYENDSESSION)
{
MessageBox.Show("queryendsession: this is a logoff, shutdown, or reboot");
systemShutdown = true;
}
// If this is WM_QUERYENDSESSION, the closing event should be
// raised in the base WndProc.
base.WndProc(ref m); //Error
} //WndProc
Error: RadWindow does not contain a definition for 'WndProc'