Beispiel #1
0
 protected virtual void OnControlPacketReceived(ControlPacketReceivedEventArgs e)
 {
     if (ControlPacketReceived != null)
     {
         ControlPacketReceived(this, e);
     }
 }
Beispiel #2
0
        void server_ControlPacketReceived(object sender, ControlPacketReceivedEventArgs e)
        {
            if (allowCursor)
            {
                int flags = 0;

                if (e.MouseAction == 1)
                {
                    flags = (int)MOUSEEVENTF_LEFTDOWN;
                }
                else if (e.MouseAction == 2)
                {
                    flags = (int)MOUSEEVENTF_LEFTUP;
                }
                else if (e.MouseAction == 3)
                {
                    flags = (int)MOUSEEVENTF_RIGHTDOWN;
                }
                else if (e.MouseAction == 4)
                {
                    flags = (int)MOUSEEVENTF_RIGHTUP;
                }
                else if (e.MouseAction == 5)
                {
                    flags = (int)MOUSEEVENTF_WHEEL;
                }
                else if (e.MouseAction == 6)
                {
                    flags = -1;

                    keybd_event((byte)e.VKeyCode, 0x45, KEYEVENTF_EXTENDEDKEY, (UIntPtr)0);
                }
                else if (e.MouseAction == 7)
                {
                    flags = -1;

                    keybd_event((byte)e.VKeyCode, 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, (UIntPtr)0);
                }

                if (flags != -1)
                {
                    if (SharingSource.GetType() == typeof(ASU.SharingSources.ActiveWindowSharingSource))
                    {
                        SharingSources.ActiveWindowSharingSource aws = (SharingSources.ActiveWindowSharingSource)SharingSource;

                        //pci.ptScreenPos.x - CaptureWindowRegion.Left - (CaptureWindowRegion.Width - CaptureRegion.Width), pci.ptScreenPos.y - CaptureWindowRegion.Top - (CaptureWindowRegion.Height - CaptureRegion.Height)

                        e.X += aws.CaptureWindowRegion.Left + (aws.CaptureWindowRegion.Width - aws.CaptureRegion.Width);
                        e.Y += aws.CaptureWindowRegion.Top + (aws.CaptureWindowRegion.Height - aws.CaptureRegion.Height);
                    }

                    if (flags == MOUSEEVENTF_WHEEL)
                    {
                        mouse_event((uint)flags, (uint)e.X, (uint)e.Y, e.Delta, 0);
                    }
                    else if (flags == 0)
                    {
                        SetCursorPos(e.X, e.Y);
                    }
                    else
                    {
                        mouse_event((uint)flags, (uint)e.X, (uint)e.Y, 0, 0);
                    }
                }
            }
        }