Hi @SK_123 I cannot reproduce the problem you mentioned. I can directly use SendInput
on the remote desktop to draw points or lines on the snipping tool.
#include <windows.h>
#include <iostream>
using namespace std;
void clickFromTo(int x, int y,int w,int h) {
INPUT click[3] = {};
click[0].type = INPUT_MOUSE;
click[0].mi.dwFlags = MOUSEEVENTF_MOVE| MOUSEEVENTF_LEFTDOWN| MOUSEEVENTF_ABSOLUTE;// Release the mouse before moving it
DWORD fScreenWidth = ::GetSystemMetrics(SM_CXSCREEN);
DWORD fScreenHeight = ::GetSystemMetrics(SM_CYSCREEN);
click[1].type = INPUT_MOUSE;
click[0].mi.dx = click[1].mi.dx = MulDiv(x, 65535, fScreenWidth);
click[0].mi.dy = click[1].mi.dy = MulDiv(y, 65535, fScreenHeight);
click[2].mi.dx = MulDiv(x + w, 65535, fScreenWidth);
click[2].mi.dy = MulDiv(y + h, 65535, fScreenHeight);
click[1].mi.dwFlags = MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE;
click[2].type = INPUT_MOUSE;
click[2].mi.dwFlags = MOUSEEVENTF_LEFTUP | MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE;
SendInput(3, click, sizeof(INPUT));
}
void mouseClick() {
INPUT click[2] = {};
click[0].type = INPUT_MOUSE;
click[0].mi.dwFlags = MOUSEEVENTF_LEFTDOWN;
click[1].type = INPUT_MOUSE;
click[1].mi.dwFlags = MOUSEEVENTF_LEFTUP;
SendInput(2, click, sizeof(INPUT));
}
int main()
{
clickFromTo(2200, 500, 50, 50);
//SetCursorPos(2200, 500);
//mouseClick();
}
Are the coordinates you use only relative to the remote desktop coordinates or based on this virtual screen? If it is relative For remote desktop coordinates, the corresponding virtual screen coordinates should be calculated first.
If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.