Here is the full function:
void clickControl(HWND hWnd, int x, int y) { POINT p; px = x; py = y; ClientToScreen(hWnd, &p); SetCursorPos(px, py); PostMessage(hWnd, WM_MOUSEMOVE, 0, MAKELPARAM(x, y)); PostMessage(hWnd, WM_LBUTTONDOWN, MK_LBUTTON, MAKELPARAM(x, y)); PostMessage(hWnd, WM_LBUTTONUP, MK_LBUTTON, MAKELPARAM(x, y)); }
user586399
source share