Zitat:
I am really trying to use the SendInput to sent the input to the mouse. I think it is with this function I am having the problem. I have the coordinates of where I want the mouseclick to occur, but I cannot seem to make the mouse click on those coordinates.
I remember having trouble with this, however i ended up coming back to mouse_event. The conversion of coordinates is a bit weird to me (it's not something i've used much), however this will click at 500 x 500:
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)
Public Const MOUSEEVENTF_MOVE = &H1 ' mouse move
Public Const MOUSEEVENTF_LEFTDOWN = &H2 ' left button down
Public Const MOUSEEVENTF_LEFTUP = &H4 ' left button up
Public Const MOUSEEVENTF_RIGHTDOWN = &H8 ' right button down
Public Const MOUSEEVENTF_RIGHTUP = &H10 ' right button up
Public Const MOUSEEVENTF_MIDDLEDOWN = &H20 ' middle button down
Public Const MOUSEEVENTF_MIDDLEUP = &H40 ' middle button up
Public Const MOUSEEVENTF_WHEEL = &H800 ' wheel button rolled
Public Const MOUSEEVENTF_ABSOLUTE = &H8000 ' absolute move
Public Sub ClickButton()
destX = 500
destY = 500
destX = destX * 65535 / Screen.Width * Screen.TwipsPerPixelX
destY = destY * 65535 / Screen.Height * Screen.TwipsPerPixelY
mouse_event MOUSEEVENTF_ABSOLUTE + MOUSEEVENTF_MOVE + MOUSEEVENTF_LEFTDOWN + MOUSEEVENTF_LEFTUP, destX, destY, 0, 0
End Sub