将鼠标位置从一台PC转移到另一台PC

时间:2014-08-27 22:15:46

标签: c++ sockets cursor mouse

我正在尝试在没有VNC的情况下构建C ++(clt)远程控制。屏幕截图流和键盘控件已经完成,现在我不知道如何控制鼠标。 我的想法是:

  1. 使用表单位置
  2. 的位置减去鼠标的Y位置
  3. 使用表单位置的左侧位置
  4. 减去鼠标的X位置
  5. 将结果与控制的pc resoultion相乘并除以表格分辨率(比例)
  6. 但它不起作用。这是代码:

    Remotescreenwitdh = SystemInformation::VirtualScreen.Width;                      
    Remotescreenhieght = SystemInformation::VirtualScreen.Height;
    
    double Curry = (double)(Cursor->Position.Y - this->Top);
    double proportionY = (double)(screenhieght / this->Height);
    double Currx = (double)(Cursor->Position.X - this->Left);
    double proportionX = (double)(screenwitdh / this->Width);
    
    int realvalx = (screenwitdh*Currx) / this->Width;                           
    int realvaly = (screenhieght*Curry) / this->Height;
    

0 个答案:

没有答案
相关问题