admin管理员组文章数量:1300174
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?
本文标签: vbnetSimulate mouse click in external window without activate itStack Overflow
版权声明:本文标题:vb.net - Simulate mouse click in external window without activate it - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741652320a2390553.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论