protected override void WndProc(ref Message msg) { // filter messages here for your purposes if (msg.Msg == 0x0402 && MessageReceived != null) { MessageReceived.DynamicInvoke(this, msg); } else { base.WndProc(ref msg); } }
protected override void WndProc(ref Message msg) { // filter messages here for SimConnect if (msg.Msg == WM_USER_SIMCONNECT && MessageReceived != null) { try { MessageReceived.DynamicInvoke(this, msg); } catch { } // If calling assembly generates an exception, we shouldn't allow it to break this process } else { base.WndProc(ref msg); } }