private void OnWinMessageCallBack(WinMessage _winMessage) { string msg = string.Empty;// = $"\n Message {_winMessage.Message} {_winMessage.WParam} {_winMessage.LParam} {_winMessage.IsHandled}"; switch (_winMessage.Message) { case WinProc_Message.WM_KEYDOWN: msg += $"\n {_winMessage.Message} {KeyInterop.KeyFromVirtualKey((int)_winMessage.WParam)}"; break; case WinProc_Message.WM_KEYUP: case WinProc_Message.WM_SYSKEYDOWN: case WinProc_Message.WM_SYSKEYUP: msg += $"\n {_winMessage.Message} {KeyInterop.KeyFromVirtualKey((int)_winMessage.WParam)}"; break; case WinProc_Message.WM_WTSSESSION_CHANGE: switch ((WParam_Message)_winMessage.WParam) { case WParam_Message.WTS_SESSION_LOCK: msg += " User Lock"; break; case WParam_Message.WTS_SESSION_UNLOCK: msg += " User UnLock"; break; } break; case WinProc_Message.WM_QUERYENDSESSION: switch ((LParam_Message)_winMessage.LParam) { case LParam_Message.ENDSESSION_CLOSEAPP: case LParam_Message.ENDSESSION_CRITICAL: msg += " WM_QUERYENDSESSION Not process now"; break; case LParam_Message.ENDSESSION_LOGOFF: msg += " WM_QUERYENDSESSION logging off"; break; } break; case WinProc_Message.WM_ENDSESSION: switch ((LParam_Message)_winMessage.LParam) { case LParam_Message.ENDSESSION_CLOSEAPP: case LParam_Message.ENDSESSION_CRITICAL: msg += " WM_ENDSESSION Not process now"; break; case LParam_Message.ENDSESSION_LOGOFF: msg += " WM_ENDSESSION logging off"; break; } break; } //_messageBox.MenuName += msg; LogTool.Logger(msg); }