C++: Send Mouse Click using PostMessage/SendMessage
I'm at the moment trying to send a right click to a computergame without affecting my visible mouse pointer. I'm not sure if the game just doesn't like it or if I'm doing something wrong. Here is the short-version of my code: WORD tx = 500; WORD ty = 500; HWND windowHandle = FindWindow(NULL,TEXT("Game title")); if (windowHandle != 0) { SendMessage(windowHandle, WM_RBUTTONDOWN, MK_RBUTTON, MAKELPARAM(tx, ty)); Sleep(50); SendMessage(windowHandle, WM_RBUTTONUP, MK_RBUTTON, MAKELPARAM(tx, ty)); Sleep(50); std::cout << "message sent..." << std::endl; } I tried this many times and made sure that th
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.