Unblock Mouse Move

139 Views Asked by At

I'm writing a program that simulates mouse movements for an application, but this program blocks mouse movement. Is there any way to circumvent this problem?

Solutions I tried and results:

SendMessage(hwnd, WM_LBUTTONDOWN, MK_LBUTTON, MAKELPARAM(x, y));
SendMessage(hwnd, WM_LBUTTONUP, MK_LBUTTON, MAKELPARAM(x, y));

There is no movement, but if the application is at the top, it sends a left click to the original position of the mouse.

SetCursorPos(x,y);

The mouse goes to the location I want, but then when I send a click it never accepts it until I manually move my mouse.

SendMessage(hwnd, WM_MOUSEMOVE, 0, MAKELPARAM(x, y));

The mouse does not provide any movement when the application is open, but it does not prevent clicks.

INPUT mouseEvent;
mouseEvent.type = INPUT_MOUSE;
mouseEvent.mi.dx = x;
mouseEvent.mi.dy = y;
mouseEvent.mi.dwExtraInfo = 0;
mouseEvent.mi.mouseData = 0;
mouseEvent.mi.time = 0;
mouseEvent.mi.dwFlags = MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE;
SendInput(1, &mouseEvent, sizeof(INPUT));
ZeroMemory(&mouseEvent, sizeof(INPUT));

The mouse does not provide any movement when the application is open, but it does not prevent clicks.

0

There are 0 best solutions below