Catch user mouse click events in window.

Is there a way I can catch all the user mouse click events inside Window

Thanks!




Answer this question

Catch user mouse click events in window.

  • Ken Shook

    "I want to collect user information about where he/she clicked inside the window"

    Oooooh. I read this as to whether they clicked in the window or not.

    The control mouse event with it's event argument is exactly what you want.





  • Greg P

    You can poll the msgproc, and get all the windows events...  Or if it's just your application, you can setup on click events and mouse move envets...

    What i do (I find generally quicker then polling msgproc), is to setup DirectX - DirectInput for Mouse and Keyboard, and poll the Mouse and Keyboard directly.

    Dustin.


  • johnbrown105

    What to you mean by "catch".  Do you simply want to do something when some sort of mouse-click event occurs, or do you want to swallow/translate the mouse-clicks

  • Craig N

    I want to collect user information about where he/she clicked inside the window



  • Patrick Fredin

    You can always capture mouse clicks. Some are more work than others.

    The easiest case is if the window in question is the form you are writing. There are Form mouse down, mouse up and click events as a part of windows forms.

    These events come with mouse event arguments  what key is down and the relative cursor location with in the form.

    If you are interested in mouse clicks on a system wide basis via the API.

  • Fonzy

    Check out the Control.MouseDown event.


  • mrmrmax

    I want to collect the mouse click information for entire OS instead of just my App. pulling message queue seems a solution



  • Montty

    OK...

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





    Public Shared Function IsSelectMouseKeyDown() As Boolean


    Const VK_LBUTTON = &H1

    Const VK_RBUTTON = &H2


    If
    Not System.Windows.Forms.SystemInformation.MouseButtonsSwapped Then

    IsSelectMouseKeyDown = GetAsyncKeyState(VK_LBUTTON)

    Else

    IsSelectMouseKeyDown = GetAsyncKeyState(VK_RBUTTON)

    End If

    End Function


    You'll have to poll this at intervals and look for whether mouse keys are down.

    You can look at the curso position (Another API routine) which gives screen coordinates. You then get to see if the cursor coordinates fall inside the windows of the program.

    There will be asynchronous form events that will firs when events occur. They are declared at design time you.

    On the left form window find "Form events". The right one will now show you the excutable events which can contain your code you meet your needs.


  • Erik Castañeda

    Dustin_H wrote:
    You can poll the msgproc, and get all the windows events... Or if it's just your application, you can setup on click events and mouse move envets...

    What i do (I find generally quicker then polling msgproc), is to setup DirectX - DirectInput for Mouse and Keyboard, and poll the Mouse and Keyboard directly.

    Dustin.

    not thank you from all people using tools detecting directx use - mainly for games optimization !


  • Catch user mouse click events in window.