|
-
May 27th, 2007, 04:50 PM
#1
Thread Starter
Hyperactive Member
[RESOLVED] Automating mouse clicks (but that one's for the gurus)
This is the code I use to simulate a mouse click within my VB app:
Code:
Declare Sub mouse_event Lib "user32.dll" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)
mouse_event MOUSEEVENTF_MOVE Or MOUSEEVENTF_ABSOLUTE, 16000, 38000, 0, 0
mouse_event MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0
mouse_event MOUSEEVENTF_LEFTUP, 0, 0, 0, 0
This works great to click wherever I want on the screen, and I've been using this solutions for years now. The problem is that if I minimize my application, it will, obviously, keep on clicking on my desktop!
I've searched the forums here and I couldn't find a solution to this. I am actually pretty pessimistic as to if it can be done in any way.
I'd like my app to do the mouse clicks & moves in background, allowing me to use the computer at the same time without affecting my mouse. In other words, the mouse clicks & moves are executed on an app that DOESN'T have the focus.
Also, in case it helps, all those mouse clicks & moves are to be executed on a WebBrowser control within my VB app. So if the fact that I only need this through the WebBrowser brings up some other possible solutions, please let me know. (Note that I am familiar with clicking links or dealing with elements within the WebBrowser - that won't help in that case).
I'll have to use such a solution in many different situations, but a good example would be to 'cheat' a flash game and prank one of my friend.
Thanks in advance to all of you VB lords/gurus.
Last edited by Krass; May 27th, 2007 at 04:53 PM.
Chris
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|