【发布时间】:2019-02-22 21:29:31
【问题描述】:
我正在尝试在我的 WPF 应用程序中检测 Windows LogOff 或 Shutdown。有人可以帮忙吗?
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
错误:RadWindow 不包含“WndProc”的定义
【问题讨论】: