BP Forums
Is there a way to bind a mouse click to a key press? - Printable Version

+- BP Forums (https://bpforums.info)
+-- Forum: Archived Forums (https://bpforums.info/forumdisplay.php?fid=55)
+--- Forum: Archived Forums (https://bpforums.info/forumdisplay.php?fid=56)
+---- Forum: VB.NET (Visual Basic 2010/2008) (https://bpforums.info/forumdisplay.php?fid=8)
+---- Thread: Is there a way to bind a mouse click to a key press? (/showthread.php?tid=497)



Is there a way to bind a mouse click to a key press? - Himansh - 03-24-2012

but what i want to
do is click the left mouse button at (x.y) by pressing Z then click at (A,B)
by pressing X

also, should i be asking somewhere else?

Thanks for the help
Himansh.


Re: Is there a way to bind a mouse click to a key press? - brandonio21 - 03-25-2012

I don't know if there is a way to programatically move the cursor on the screen. If there is, I have never heard of it.


Re: Is there a way to bind a mouse click to a key press? - xolara - 03-25-2012

to move the mouse

Code:
Cursor.Position = New Point(MouseposX, MouseposY)

mouse click

Code:
Public Declare Sub mouse_event Lib "user32" Alias "mouse_event" (ByVal dwFlags As Integer, ByVal dx As Integer, ByVal dy As Integer, ByVal cButtons As Integer, ByVal dwExtraInfo As Integer)
    Public Const MOUSEEVENTF_LEFTDOWN = &H2
    Public Const MOUSEEVENTF_LEFTUP = &H4
    Public Const MOUSEEVENTF_MIDDLEDOWN = &H20
    Public Const MOUSEEVENTF_MIDDLEUP = &H40
    Public Const MOUSEEVENTF_RIGHTDOWN = &H8
    Public Const MOUSEEVENTF_RIGHTUP = &H10
    Public Const MOUSEEVENTF_MOVE = &H1
  mouse_event(mouseclickup = 0, 0, 0, 0, 0)
        mouse_event(mouseclickdown = 0, 0, 0, 0, 0)
Private Const mouseclickup = 4
    Private Const mouseclickdown = 2



Re: Is there a way to bind a mouse click to a key press? - Himansh - 03-25-2012

Thanks All the above users
!!!!!!!!!!!!!


Re: Is there a way to bind a mouse click to a key press? - brandonio21 - 03-25-2012

xolara Wrote:to move the mouse
Code:
Cursor.Position = New Point(MouseposX, MouseposY)

Ah, that could come in handy.. thanks!