Search the Community
Showing results for tags 'mouseclick inactive window'.
-
I have several instances of testing program and i want to run concurrent test on them. So i need a way to click on the links on them. Tried controlcick and it need active window to work. I tested with simple click anywhere on window. it get registered only if window is activated. Tried Post message , Sendmessage, then dont work at all even window is activated. Func _PostMessage_Click($hWnd, $X = -1, $Y = -1, $Button = "left", $Clicks = 1, $Delay = 10) If Not IsHWND($hWnd) And $hWnd <> "" Then $hWnd = WinGetHandle($hWnd) EndIf If Not IsHWND($hWnd) Then Return SetError(1, "", False) EndIf If StringLower($Button) == "left" Then $Button = $WM_LBUTTONDOWN ElseIf StringLower($Button) == "right" Then $Button = $WM_RBUTTONDOWN ElseIf StringLower($Button) == "middle" Then $Button = $WM_MBUTTONDOWN If $Delay == 10 Then $Delay = 100 EndIf $WinSize = WinGetClientSize($hWnd) If $X == -1 Then $X = $WinSize[0] / 2 If $Y == -1 Then $Y = $WinSize[1] / 2 $User32 = DllOpen("User32.dll") If @error Then Return SetError(2, "", False) For $j = 1 To $Clicks DllCall($User32, "int", "PostMessage", "HWND", $hWnd, "uint", $Button, "WPARAM", 1, "LPARAM", _MakeLong($X, $Y)) Sleep($Delay) DllCall($User32, "int", "PostMessage", "HWND", $hWnd, "uint", $Button + 1, "WPARAM", 0, "LPARAM", _MakeLong($X, $Y)) Next DllClose($User32) Return SetError(0, 0, True) EndFunc Any expert here in this area to help? I must make it work. Because without it it takes 1 sec for window to get activated in slow machine. So i have to wait 8 sec for 8 instance. Not acceptable. Let me know. thanks very much.