• Welcome to Valhalla Legends Archive.
 

Send Mouse

Started by Imperceptus, March 30, 2004, 03:47 PM

Previous topic - Next topic

Imperceptus

Does anyone know how to send mouse coordinates and events to another window?
Quote from: Hazard on August 07, 2003, 03:15 PM
Highlight your entire code. Press the delete key. Start over again using Cuphead's CSB tutorial and work your way from their rather than raping code from downloaded sources meant purely for learning purposes. If this does not fix the problem, uninstall Visual Basic and get a new hobby. I suggest Cricket.

Eli_1

#1
Quote from: Imperceptus on March 30, 2004, 03:47 PM
Does anyone know how to send mouse coordinates. . .
Yes:

Declare Function SetCursorPosition Lib "user32" _
(ByVal x as long, ByVal y as long) as Long



Quote from: Imperceptus on March 30, 2004, 03:47 PM
. . . and events
Yes:

'//Here's the prototype, Imp
Public Declare Sub mouse_event Lib "user32" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)

'//Some constants it uses
Const EVENT_LEFTDOWN = &H2
Const EVENT_LEFTUP = &H4
Const EVENT_MIDDLEDOWN = &H20
Const EVENT_MIDDLEUP = &H40
Const EVENT_RIGHTDOWN = &H8
Const EVENT_RIGHTUP = &H10
Const EVENT_MOVE = &H1

'//Useage
'//Example shows you how to left click
mouse_event EVENT_LEFTDOWN, 0, 0, 0, 0
mouse_event EVENT_LEFTUP, 0, 0, 0, 0


[Edit 1      ] Added the second part of his question
[Edit 2 - 9] Re-arranged the text  :-\

Imperceptus

Quote from: Hazard on August 07, 2003, 03:15 PM
Highlight your entire code. Press the delete key. Start over again using Cuphead's CSB tutorial and work your way from their rather than raping code from downloaded sources meant purely for learning purposes. If this does not fix the problem, uninstall Visual Basic and get a new hobby. I suggest Cricket.

Imperceptus

Extra note, I think your example is for .Net... that or you were just poking me in the right direction.

Declare Function SetCursorPosition Lib "user32" _
(ByVal x as long, ByVal y as long) as Long


Gives entry point error on user32.dll

Using SetCursorPos instead.
Quote from: Hazard on August 07, 2003, 03:15 PM
Highlight your entire code. Press the delete key. Start over again using Cuphead's CSB tutorial and work your way from their rather than raping code from downloaded sources meant purely for learning purposes. If this does not fix the problem, uninstall Visual Basic and get a new hobby. I suggest Cricket.

Eli_1

Quote from: Imperceptus on March 31, 2004, 11:22 PM
Extra note, I think your example is for .Net... that or you were just poking me in the right direction.
I figured setting the cursor position is easy enough to figure out, yet the mouse_event is a little harder, which is why I gave you code for that one.