Results 1 to 3 of 3

Thread: mouse movement outside application's form

  1. #1

    Thread Starter
    Frenzied Member wengang's Avatar
    Join Date
    Mar 2000
    Location
    Beijing, China
    Posts
    1,604
    Does anybody know of a way to determine if the mouse has been moved even when the application that is checking mouse movement is minimized.

    i.e. a program that determines when the mouse has been moved when the user is using another program?


  2. #2
    Addicted Member
    Join Date
    Jul 2000
    Location
    Scotland
    Posts
    184
    I have seen such a thing coded using API's. Try asking there. I will have a look for you and post soon, but hope this is a pointer for you in the meantime.

  3. #3
    Guest
    Try this. Make a Form with a Timer and put the following code into your Form.

    Code:
    Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
    Private Declare Function SetCursorPos Lib "user32" (ByVal X As Long, ByVal Y As Long) As Long
    
    Private Type POINTAPI
        X As Long
        Y As Long
    End Type
    
    Dim CurPos As POINTAPI
    Dim OldX As Single
    Dim OldY As Single
    
    
    Private Sub Form_Load()
    
        Timer1.Interval = 10
        Timer1.Enabled = True
        
    End Sub
    
    Private Sub Timer1_Timer()
    
        'The the coordinates of the Mouse
        Retval = GetCursorPos(CurPos)
        X = CurPos.X
        Y = CurPos.Y
        
        If OldX = X And OldY = Y Then
            'The mouse is still
        Else
            'the Mouse has moved
            OldX = X
            OldY = Y
            Beep
        End If
        
    End Sub

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