ciao!
leggendo sul forum ho trovato questo codice dato da MITALY
codice:
Private Type POINTAPI
x As Long
y As Long
End Type
Private Const MOUSEEVENTF_ABSOLUTE = &H8000 ' absolute move
Private Const MOUSEEVENTF_LEFTDOWN = &H2 ' left button down
Private Const MOUSEEVENTF_LEFTUP = &H4 ' left button up
Private Const MOUSEEVENTF_MOVE = &H1 ' mouse move
Private Const MOUSEEVENTF_MIDDLEDOWN = &H20
Private Const MOUSEEVENTF_MIDDLEUP = &H40
Private Const MOUSEEVENTF_RIGHTDOWN = &H8
Private Const MOUSEEVENTF_RIGHTUP = &H10
Private 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)
Private Declare Function GetMessageExtraInfo Lib "user32" () As Long
Private Declare Function GetSystemMetrics Lib "user32" (ByVal nIndex As Long) As Long
Const SM_CXSCREEN = 0 'X Size of screen
Const SM_CYSCREEN = 1 'Y Size of Screen
Private Sub ScreenToAbsolute(lpPoint As POINTAPI)
lpPoint.x = lpPoint.x * (&HFFFF& / GetSystemMetrics(SM_CXSCREEN))
lpPoint.y = lpPoint.y * (&HFFFF& / GetSystemMetrics(SM_CYSCREEN))
End Sub
Private Sub MoveCursor(p As POINTAPI)
'p.X and p.Y in absolute coordinates
'Put the mouse on the point
mouse_event MOUSEEVENTF_ABSOLUTE Or MOUSEEVENTF_MOVE, p.x, p.y, 0, GetMessageExtraInfo()
End Sub
e
codice:
Dim p As POINTAPI 'struttura che contiene le coordinate a cui spostare il puntatore
p.x=100 'coordinata X
p.y=200 'coordinata Y
ScreenToAbsolute p 'converte il punto da coordinate dello schermo a coordinate "assolute" (espresse in 65536esimi di lunghezza/altezza dello schermo)
MoveCursor p 'muove
fino a qui tutto bene, a me servirebbe una cosa simile però che sul asse X del puntatore (p.x) fosse comandato dal mouse(cioè l'asse X lo devo comandare con il mouse e Y con un valore fisso come nel codice (p.y= 200))...scusate se la domanda può sembrare da principianti ma sono nuovo della programmazione