CONTAR CLIQUES DO MOUSE
GOSTARIA DE SABER COMO FAÇO PARA EU CONTAR OS CLIQUES DO MOUSE NO WINDOWS, OU SEJA, TENHA UMA APLICAÇÃO QUE MONITORA O MOVIMENTO DO MOUSE, MAIS INFELIZMENTE NÃO CONSEGUI PEGAR O CLIQUE.
Então pesso ajuda a vcs, tenho ums aplicação rodando oculto e no exato momento que o usuaario do RuWindows der um clique eu conto esse clique mais 1.
Grato
Então pesso ajuda a vcs, tenho ums aplicação rodando oculto e no exato momento que o usuaario do RuWindows der um clique eu conto esse clique mais 1.
Grato
Achei algumas coisas que podem lhe enteressar:
COLOCAR EM UMA CLASS:
Option Explicit
Private Declare Sub mouse_event Lib "user32" (ByVal dwFlags As Long, ByVal dX As Long, ByVal dY As Long, ByVal dwData As Long, ByVal dwExtraInfo As Long)
' Flags used with mouse_event
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_MIDDLEDOWN = &H20 ' middle button down
Private Const MOUSEEVENTF_MIDDLEUP = &H40 ' middle button up
Private Const MOUSEEVENTF_MOVE = &H1 ' mouse move
Private Const MOUSEEVENTF_RIGHTDOWN = &H8 ' right button down
Private Const MOUSEEVENTF_RIGHTUP = &H10 ' right button up
Private Const MOUSEEVENTF_WHEEL = &H800 ' wheel button rolled
' ***********************************************************
' Public Properties
' ***********************************************************
Public Property Let ClickDelay(ByVal NewVal As Long)
If NewVal >= 0 Then m_ClickDelay = NewVal
End Property
Public Property Get ClickDelay() As Long
ClickDelay = m_ClickDelay
End Property
' ***********************************************************
' Public Methods
' ***********************************************************
Public Sub ButtonPress(ByVal Button As MouseButtonConstants)
' Depress mouse button at current screen location.
Select Case Button
Case vbLeftButton, vbMiddleButton, vbRightButton
Call mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0)
Case vbMiddleButton
Call mouse_event(MOUSEEVENTF_MIDDLEDOWN, 0, 0, 0, 0)
Case vbRightButton
Call mouse_event(MOUSEEVENTF_RIGHTDOWN, 0, 0, 0, 0)
End Select
End Sub
Public Sub ButtonRelease(ByVal Button As MouseButtonConstants)
' Release mouse button at current screen location.
Select Case Button
Case vbLeftButton, vbMiddleButton, vbRightButton
Call mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0)
Case vbMiddleButton
Call mouse_event(MOUSEEVENTF_MIDDLEUP, 0, 0, 0, 0)
Case vbRightButton
Call mouse_event(MOUSEEVENTF_RIGHTUP, 0, 0, 0, 0)
End Select
End Sub
Public Sub Click()
' Click the mouse, with delay to simulate human timing.
Call mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0)
If m_ClickDelay Then
DoEvents ' allow down position to paint
Call Sleep(m_ClickDelay)
End If
Call mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0)
End Sub
' X/Y need to be passed as pixels!
Public Sub ClickAbsolute(ByVal X As Long, ByVal Y As Long)
' Move cursor to destination, first.
Call Me.MoveTo(X, Y)
' Click it
Call Me.Click
End Sub
COLOCAR EM UMA CLASS:
Option Explicit
Private Declare Sub mouse_event Lib "user32" (ByVal dwFlags As Long, ByVal dX As Long, ByVal dY As Long, ByVal dwData As Long, ByVal dwExtraInfo As Long)
' Flags used with mouse_event
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_MIDDLEDOWN = &H20 ' middle button down
Private Const MOUSEEVENTF_MIDDLEUP = &H40 ' middle button up
Private Const MOUSEEVENTF_MOVE = &H1 ' mouse move
Private Const MOUSEEVENTF_RIGHTDOWN = &H8 ' right button down
Private Const MOUSEEVENTF_RIGHTUP = &H10 ' right button up
Private Const MOUSEEVENTF_WHEEL = &H800 ' wheel button rolled
' ***********************************************************
' Public Properties
' ***********************************************************
Public Property Let ClickDelay(ByVal NewVal As Long)
If NewVal >= 0 Then m_ClickDelay = NewVal
End Property
Public Property Get ClickDelay() As Long
ClickDelay = m_ClickDelay
End Property
' ***********************************************************
' Public Methods
' ***********************************************************
Public Sub ButtonPress(ByVal Button As MouseButtonConstants)
' Depress mouse button at current screen location.
Select Case Button
Case vbLeftButton, vbMiddleButton, vbRightButton
Call mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0)
Case vbMiddleButton
Call mouse_event(MOUSEEVENTF_MIDDLEDOWN, 0, 0, 0, 0)
Case vbRightButton
Call mouse_event(MOUSEEVENTF_RIGHTDOWN, 0, 0, 0, 0)
End Select
End Sub
Public Sub ButtonRelease(ByVal Button As MouseButtonConstants)
' Release mouse button at current screen location.
Select Case Button
Case vbLeftButton, vbMiddleButton, vbRightButton
Call mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0)
Case vbMiddleButton
Call mouse_event(MOUSEEVENTF_MIDDLEUP, 0, 0, 0, 0)
Case vbRightButton
Call mouse_event(MOUSEEVENTF_RIGHTUP, 0, 0, 0, 0)
End Select
End Sub
Public Sub Click()
' Click the mouse, with delay to simulate human timing.
Call mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0)
If m_ClickDelay Then
DoEvents ' allow down position to paint
Call Sleep(m_ClickDelay)
End If
Call mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0)
End Sub
' X/Y need to be passed as pixels!
Public Sub ClickAbsolute(ByVal X As Long, ByVal Y As Long)
' Move cursor to destination, first.
Call Me.MoveTo(X, Y)
' Click it
Call Me.Click
End Sub
Tem esse link ai tambem:
http://www.vbmania.com.br/vbmdetail.php?varID=424
http://www.vbmania.com.br/vbmdetail.php?varID=424
Tem este aqui...
COUNT CLICKS PLANET-SOURCE-CODE
COUNT CLICKS PLANET-SOURCE-CODE
Tópico encerrado , respostas não são mais permitidas