Mouse coordinates to record click events

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Mihail
    Contributor
    • Apr 2011
    • 759

    Mouse coordinates to record click events

    Hi all !
    Can you help me ? I use VB6. Thank you !

    I have some code to indicate the mouse position when I move it over my screen (not only over a form or a control).
    Now I wish to intercept the CLICK event. In fact I wish to "teach" my program where to make automatic clicks. Something like recording a macro in Excel: When I make a click my program must "feel" that and create a list with coordinates.

    I know all I need for that except how to intercept the click event. I repeat: a click somewhere on my screen, even in an empty area.

    I know that my English is not strong. Hope you understand my need.

    Thank you for your patience.
  • Mihail
    Contributor
    • Apr 2011
    • 759

    #2
    Evrika !
    Code:
    Option Explicit
    ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    ' Copyright ©2003-2010 Vivek Nigam, All Rights Reserved.
    ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    ' Purpose : See if the left or right  mouse button is clicked or relised outside and inside the program
    ' You are free to use this code within your own applications only,
    ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
    Const Cap1 = "Capture Mouse Events"
    
    Private Sub Form_Load()
        frmCaptureMouseEvents.Caption = Cap1
    End Sub
    
    Private Sub Timer1_Timer()
        '// To check left mouse button pass 1,
        If GetAsyncKeyState(1) = 0 Then
            Label1.Caption = "Your Left Mouse Button Is UP"
        Else
            Label1.Caption = "Your Left Mouse Button Is Down"
        End If
        
        '// To check right mouse button pass 2,
        
    '    If GetAsyncKeyState(2) = 0 Then
    '        Label1.Caption = "Your Right Mouse Button Is UP"
    '    Else
    '        Label1.Caption = "Your Right Mouse Button Is Down"
    '    End If
    '
    End Sub

    Comment

    Working...