Reputation: 394
iWith this code:
Private Sub Press(MyTableHwnd As IntPtr, X As Integer, Y As Integer)
Dim lParam As IntPtr = MakeLong(X, Y)
NativeMethods.SendMessage(MyTableHwnd, WM_MOUSEMOVE, IntPtr.Zero, lParam)
NativeMethods.SendMessage(MyTableHwnd, WM_LBUTTONDOWN, IntPtr.Zero, lParam)
Sleep(50)
NativeMethods.SendMessage(MyTableHwnd, WM_MOUSEMOVE, IntPtr.Zero, lParam)
NativeMethods.SendMessage(MyTableHwnd, WM_LBUTTONUP, IntPtr.Zero, lParam)
End Sub
Private Shared Function MakeLong(X As Integer, Y As Integer) As IntPtr
Return CType((Y << 16) Or (X And &HFFFF), IntPtr)
End Function
I can press without problems a button at X, Y coordinates of some esternal windows. The problem is that, may be depending from the window code, some external windows rest in background (clicked even if under other windows), that's my goal, while other windows jump in the foreground, activated.
NOTE: other windows jump in the foreground even if I comment the WM_MOUSEMOVE rows... and the buttons are not pressed unless I don't manually move the mouse cursor over them. So I need the whole code.
Now the question: some ideas about code to add to the my above code to avoid the activation and foreground of all the windows?
Upvotes: -1
Views: 33