GETCURSORPOS COMO UTILIZO?

USUARIO.EXCLUIDOS 02/05/2005 19:11:01
#81355
Ae pessoal do forum, alguem pode me dizer como posso pegar o movimento do mouse atraves da api GetcursorPos?

obs: quero x e y



GABRIEL.LOGAN 02/05/2005 19:39:10
#81358
Cara se não me engano funciona so no VB.NET:

(Peguei na Internet)

Private Type POINTAPI
X As Long
Y As Long
End Type
Private Declare Function SetCapture Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function ReleaseCapture Lib "user32" () As Long
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Dim Pt As POINTAPI
Private Sub Form_Load()
'KPD-Team 1999
'URL: http://www.allapi.net/
'E-Mail: KPDTeam@Allapi.net
'redirect all mouse input to this form
SetCapture Me.hwnd
End Sub
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
ReleaseCapture
SetCapture Me.hwnd
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
'Get the current cursor position
GetCursorPos Pt
Me.CurrentX = 0
Me.CurrentY = 0
'Clear the screen
Me.Cls
Me.Print "Cursor position:"
'Print the mouse coà¶rdinates to the form
Me.Print "X:" + Str$(Pt.X) + " Y:" + Str$(Pt.Y)
Me.Print " (Press ALT-F4 to unload this form)"
SetCapture Me.hwnd
End Sub
Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
ReleaseCapture
SetCapture Me.hwnd
End Sub
GABRIEL.LOGAN 02/05/2005 19:40:28
#81359
USUARIO.EXCLUIDOS 03/05/2005 07:39:13
#81382
Private Type POINTAPI 
X As Long
Y As Long
End Type

Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long


Dim tCursor as POINTAPI

GetCursorPos tCursor


tCursor.X é o valor X do cursor
tCursor.Y é o valor Y.

Tudo isso em pixels
Tópico encerrado , respostas não são mais permitidas