コード例 #1
0
 private void _mSocket_OnNotifyMulticastSocketListener(object sender, NotifyMulticastSocketListenerEventArgs e)
 {
     if (e.Type == MulticastSocketMessageType.MessageReceived)
     {
         var msg = System.Text.Encoding.ASCII.GetString((byte[])e.NewObject);
         var res = new PointerMessage(Convert.ToInt32(msg.Split('@')[0]), Convert.ToInt32(msg.Split('@')[1]), (PointerEvent)Enum.Parse(typeof(PointerEvent), msg.Split('@')[2]));
         HandleMessage(res);
         if (DataReceived != null)
         {
             DataReceived(this, new DataEventArgs(msg));
         }
     }
 }
コード例 #2
0
 private void HandleMessage(PointerMessage res)
 {
     switch (res.Message)
     {
         case PointerEvent.MouseMove:
             SetCursorPos(res.X, res.Y);
             break;
         case PointerEvent.MouseDown:
             mouse_event(MOUSEEVENTF_LEFTDOWN, res.X, res.Y, 0, 0);
             break;
         case PointerEvent.MouseUp:
             mouse_event(MOUSEEVENTF_LEFTUP, res.X, res.Y, 0, 0);
             break;
     }
 }