Results 1 to 2 of 2

Thread: get mouse click?

  1. #1

    Thread Starter
    Junior Member Caleb's Avatar
    Join Date
    Jan 2001
    Posts
    24

    Question

    Can anyone tell me how to use api calls to retrieve the clicking of the mouse? Or is it impossible?

  2. #2
    coder. Lord Orwell's Avatar
    Join Date
    Feb 2001
    Location
    Elberfeld, IN
    Posts
    7,628
    you can detect Mouseclicks pretty easily using a function that you would never think of, due to its name.

    Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer


    Private Sub Command1_Click()
    Dim KeyState As Integer
    Do While DoEvents > 0

    KeyState = GetAsyncKeyState(vbKeyLButton)
    Debug.Print KeyState
    If (KeyState And &HF000) <> 0 Then MsgBox "Mouse1"
    KeyState = GetAsyncKeyState(vbKeyRButton)
    If (KeyState And &HF000) <> 0 Then MsgBox "Mouse2"
    KeyState = GetAsyncKeyState(vbKeyMButton)
    If (KeyState And &HF000) <> 0 Then MsgBox "Mouse3"

    Loop

    End Sub
    Last edited by Lord Orwell; Mar 16th, 2001 at 09:59 PM.
    My light show youtube page (it's made the news) www.youtube.com/@lightsofelberfeld
    Contact me on the socials www.facebook.com/lordorwell

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