Hi,
Im trying to move mouse and click inside another window to automate a mundane task. Im testing it on a paint window.
I can send keyboard entires fine but cant seem to get the mouse working.
What am i doing wrong?
#include <windows.h>
#include <stdio.h>
int main()
{
POINT pt;
pt.x = 20;
pt.y = 20;
DWORD dw = MAKEWORD(pt.x, pt.y);
HWND PaintWindow = FindWindow(NULL, "Untitled - Paint");
if (PaintWindow != NULL)
{
ShowWindow(PaintWindow, SW_SHOWMAXIMIZED);
SetForegroundWindow(PaintWindow);
SendMessage(PaintWindow, WM_MOUSEMOVE, 0, dw);
SendMessage(PaintWindow, WM_LBUTTONDOWN, MK_LBUTTON, dw);
SendMessage(PaintWindow, WM_LBUTTONUP, MK_LBUTTON, dw);
}
return 0;
}