this is an problem on windows platform. my windows is win 10 64 bit. i have an qt application and can find the window by findwindow. then i use postmessage from another process to simulate mouse click on the qt window, but this does not take effect. my code is as below.
void SimuClick(HWND hwnd, int x, int y)
{
LPARAM point = MAKELPARAM(x, y);
::PostMessage(hwnd, WM_LBUTTONDOWN, MK_LBUTTON, point);
::PostMessage(hwnd, WM_LBUTTONUP, 0, point);
}
more details:
- the code takes effect on other window
- when i use the mouse to click the qt window. i can watch WM_LBUTTONDOWN and WM_LBUTTONUP messages posted to the qt window with spy++
- the qt window has WS_POPUP|WS_CAPTION|WS_VISIBLE|WS_CLIPSIBLINGS|WS_CLIPCHILDREN|WS_SYSMENU|WS_THICKFRAME|WS_MINIMIZEBOX style
SendInputinstead - Dmitry Sazonov