Exemplo n.º 1
0
        protected override void WndProc(ref Message m)
        {
            if (m.Msg == WM_COPYDATA)
            {
                CopyDataStruct cps = (CopyDataStruct)Marshal.PtrToStructure(m.LParam, typeof(CopyDataStruct));

                if ((uint)cps.dwData != Alloclave.ConstantsBridge.Win32Id)
                {
                    // TODO: Error
                    return;
                }

                MessageReceivedEventArgs e = new MessageReceivedEventArgs();
                e.Bytes = new byte[cps.cbData];
                Marshal.Copy(cps.lpData, e.Bytes, 0, cps.cbData);
                MessageReceived.Invoke(this, e);
            }

            base.WndProc(ref m);
        }
Exemplo n.º 2
0
 void MessageWindow_MessageReceived(object sender, MessageReceivedEventArgs e)
 {
     ProcessPacket(e.Bytes);
 }