|
-
Apr 28th, 2000, 05:26 PM
#1
Is it possible to generate a mouse click at a ceratin point OUTSIDE the form? I've seen a function called SendInput in the user32.dll but I'm not sure how to use it. The example here (http://www.vbapi.com/ref/s/sendinput.html) is not very good and I've tried it on NT but not 98. If anyone knows of a different way to generate mouse clicks OUTSIDE forms please tell me.
Also, the Beep function from kernel32.dll doesn't work if you have a sound card (or maybe it does, I just can't get it to work with the PC Speaker) but a PC Speaker.
-
Apr 29th, 2000, 07:02 AM
#2
Member
You may not believe this but your post helped my quite a bit. I have been searching for some time on how to simulate mouse buttons but as yet have not been able to find a method to complete this goal.
You mentioned using the "sendinput" API function. Here as an example I got off of the http://www.vbapi.com website you mentioned:
Dim inputevents(0 To 2) As INPUT_TYPE ' holds information about each event
Dim mouseevent As MOUSEINPUT ' temporarily hold mouse input info
' Load the information needed to synthesize pressing the right mouse button.
mouseevent.dx = 0 ' no horizontal movement
mouseevent.dy = 0 ' no vertical movement
mouseevent.mouseData = 0 ' not needed
mouseevent.dwFlags = MOUSEEVENTF_RIGHTDOWN ' right button down
mouseevent.dwTime = 0 ' use the default
mouseevent.dwExtraInfo = 0 ' not needed
' Copy the structure into the input array's buffer.
inputarray(0).dwType = INPUT_MOUSE ' mouse input
CopyMemory inputevents(0).xi(0), mouseevent, Len(mouseevent)
' Do the same as above, but for releasing the right mouse button.
mouseevent.dx = 0 ' no horizontal movement
mouseevent.dy = 0 ' no vertical movement
mouseevent.mouseData = 0 ' not needed
mouseevent.dwFlags = MOUSEEVENTF_RIGHTUP ' right button up
mouseevent.dwTime = 0 ' use the default
mouseevent.dwExtraInfo = 0 ' not needed
' Copy the structure into the input array's buffer.
inputarray(1).dwType = INPUT_MOUSE ' mouse input
CopyMemory inputevents(1).xi(0), mouseevent, Len(mouseevent)
' Now that all the information for the two input events has been placed
' into the array, finally send it into the input stream.
SendInput(2, inputevents(0), Len(inputevents(0)) ' place the events into the
Hope this helps!
TheLeeMan
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
|