Results 1 to 4 of 4

Thread: State of the mousebuttons

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jul 2002
    Posts
    147

    Question State of the mousebuttons

    Is there a way of trapping a mousedown outside a vb program

    If not, how do I read the state of the mousebutton?
    (And I don't mean in a mouse_down event...)

  2. #2
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    You can probably use a mouse hook, or to test whether a button is up or down you can use GetAsyncKeyState...
    VB Code:
    1. Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
    2.  
    3. Private Sub Timer1_Timer()
    4.      
    5.     If (GetAsyncKeyState(vbLeftButton) And &H8000) Then
    6.         Me.Caption = "Left Button Down"
    7.     Else
    8.         Me.Caption = "Left Button Up"
    9.     End If
    10.    
    11. End Sub
    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jul 2002
    Posts
    147

    Thanks

    That works OK!

    But how about trapping keys from the keyboard outside a vbprogram?

  4. #4
    Super Moderator manavo11's Avatar
    Join Date
    Nov 2002
    Location
    Around the corner from si_the_geek
    Posts
    7,171
    This should help you...
    Attached Files Attached Files


    Has someone helped you? Then you can Rate their helpful post.

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