如何在vb.net中模拟鼠标点击
我希望能够在 vb.net 中的 WebBroswer 上模拟鼠标点击(即使程序不在顶部,它也会在后台运行)我该怎么做?我希望它在网络浏览器中每秒单击一个按钮。有什么想法吗?
提前致谢
I wants to be able to simulate mouse clicks on a WebBroswer in vb.net (even when the program in not on top, it will run in the background) How would I do this? I want it to click on a button every one second in the webBrowser. Any ideas?
Thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
警告:这是使用 Excel 4 宏的可怕黑客行为。它实际上是用 VBScript 编写的,但如果我没记错的话,在 .NET 中的语法即使不完全相同,也是相似的。当然,你需要安装Excel。
期待更多优雅的答案!
Warning: This is an awful hack using an Excel 4 macro. It's actually written in VBScript, but if I'm not mistaken the syntax is similar if not identical in .NET. Of course, you need Excel to be installed.
Looking forward to more elegant answers!
您的操作数量有限,点击后才有效。使用计时器,并在每个计时器滴答时随机选择一个操作,并按顺序编号。
you will have a limited number of actions, that are valid after clicking. Use a timer and at each timer-tick select one of the actions randomly, numbering them sequentially.
在Excel.Quit....之前
执行以下操作:
以下就像模拟鼠标左键单击:
进行 IE 焦点或应用程序焦点:
Before you Excel.Quit....
do the following:
The following is like simulation of mouse left click:
do a IE focus OR app focus: