In the use of C # system message capture, how to distinguish the message is off or restart?
//系统关机事件捕获, 并发送数据给串口 private const int WM_QUERYENDSESSION = 0x0011; protected override void WndProc(ref System.Windows.Forms.Message m) { try { switch (m.Msg) { case WM_QUERYENDSESSION: //暂时屏蔽关机拦截 m.Result = (IntPtr)1; break; } base.WndProc(ref m); } catch (Exception e) { MessageBox.Show(e.Message); } }
Quote: If this parameter is 0, the system is shutting down or restarting (it is not possible to determine which event is occurring).
lParam
LParam
System.Windows.Forms.Message
Quote:lParam This parameter can be one or more of the following values. If this parameter is 0, the system is shutting down or restarting (it is not possible to determine which event is occurring).
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)