protected override void WndProc(ref Message m) { if ((int)Lib.Win.Document.Win32.Msgs.WM_SYSCOMMAND == m.Msg && (int)m.WParam == Lib.Win.Document.Win32.User32.SC_CLOSE) { _closeClick = true; } if ((int)Lib.Win.Document.Win32.Msgs.WM_COPYDATA == m.Msg && m.LParam != null) { try { string text = string.Empty; var cd = new Lib.Win.Document.Win32.User32.COPYDATASTRUCT(); cd = (Lib.Win.Document.Win32.User32.COPYDATASTRUCT)Marshal.PtrToStructure(m.LParam, typeof(Lib.Win.Document.Win32.User32.COPYDATASTRUCT)); if (cd.dwData == 1024) { if (cd.cbData > 0) { var B = new byte[cd.cbData]; IntPtr lpData = cd.lpData; Marshal.Copy(lpData, B, 0, cd.cbData); text = Encoding.UTF8.GetString(B); Console.WriteLine("{0}: Message: {1}", DateTime.Now.ToString("HH:mm:ss fff"), text); } } text = text.Trim(); try { AnalyzeArgs(text); } catch (Exception ex) { Lib.Win.Data.Env.WriteToLog(ex); Kesco.Lib.Win.Error.ErrorShower.OnShowError(this, ex.Message, Environment.StringResources.GetString("Error")); } m.Result = new IntPtr(1); return; } catch (Exception ex) { Lib.Win.Data.Env.WriteToLog(ex); } } if (m.Msg == (int)Lib.Win.Document.Win32.Msgs.WM_HOTKEY && ActiveForm != null) { HotKeys.DoWork(m.WParam); } base.WndProc(ref m); }