Results 1 to 2 of 2

Thread: how to detect mouse click through API??

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jan 2001
    Location
    mumbai(india)
    Posts
    26

    Question

    how do i detect whether a mouse is clicked, using API, even if the cursor may not be over a VBform.
    please help me out

  2. #2
    Matthew Gates
    Guest
    Use the GetAsyncKeyState API function.


    Code:
    Private Declare Function GetAsyncKeyState _
    Lib "user32.dll" (ByVal vKey As Long) As Integer
    
    
    Private Sub Timer1_Timer()
        If GetAsyncKeyState(vbLeftButton) Then Msgbox "Left button clicked"
        If GetAsyncKeyState(vbMiddleButton) Then Msgbox "Middle button clicked"
        If GetAsyncKeyState(vbRightButton) Then Msgbox "Right button clicked"
    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