Results 1 to 5 of 5

Thread: Mouse Movement

  1. #1

    Thread Starter
    Addicted Member hyousuf2's Avatar
    Join Date
    Dec 2004
    Location
    Dublin
    Posts
    226

    Mouse Movement

    hi
    i want to knw that three has been no mouse movents or no key strokes for a particular interval lets say 2 minutes, in other words i want to knw if system remain idle for this interval ...

  2. #2
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Mouse Movement

    you could use a timer, but you'd have to start it.

  3. #3

    Thread Starter
    Addicted Member hyousuf2's Avatar
    Join Date
    Dec 2004
    Location
    Dublin
    Posts
    226

    Re: Mouse Movement

    hey wat do u mean by that ... pls elaborate !

  4. #4
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: Mouse Movement

    It's not as simple as it may sounds - system wide hook will need to be created if you want it to work "properly".
    If you want to get an idea of how complicated this could be - take alook at this sample project from vbaccelerator .

    Good luck.

  5. #5

    Thread Starter
    Addicted Member hyousuf2's Avatar
    Join Date
    Dec 2004
    Location
    Dublin
    Posts
    226

    Re: Mouse Movement

    well i also found some module code to get mouse n key strokes n it said that use a timer to control its timings now, i tried using timer with 10 seconds interval but i think it does not return proper value. here is da code

    Option Explicit

    Private Type POINTAPI
    x As Integer
    y As Integer
    End Type

    Private Declare Sub GetCursorPos Lib "user32.dll" (lpPoint As POINTAPI)
    Private Declare Function GetAsyncKeyState Lib "user32.dll" (ByVal vKey As Long) As Integer

    Private posOld As POINTAPI
    Private posNew As POINTAPI

    '------------------------------
    'Now create a new function in MoveDetect
    '-------------------------------

    Public Function InputCheck() As Boolean
    Dim i As Integer

    'Get the current mouse cursor coordinates
    Call GetCursorPos(posNew)
    'Compare with old coordinates
    If ((posNew.x <> posOld.x) Or (posNew.y <> posOld.y)) Then
    posOld = posNew
    InputCheck = True
    Exit Function
    End If
    'Check keys state
    For i = 0 To 255
    If (GetAsyncKeyState(i) And &H8001) <> 0 Then
    InputCheck = True
    Exit Function
    End If
    Next i
    InputCheck = False
    End Function

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width