locked
detecting mouse clicks RRS feed

  • Question

  • I am trying to create a program that records your mouse movement and where you click (including the type of click - left or right button), I have managed to record and successfully playback the mouse movement and create virtual clicks, but how would I detect the mouse clicks? Please could somebody post the code needed to detect a left mouse button click. Also the mouse clicks will not be occuring inside the form itself, I will be running another program.

     

    Thanks

    Thursday, January 4, 2007 11:03 PM

Answers

  • You can try MouseLeave event when leave the form, in the form use MouseMove. and use the mouseDown to catch the click event (catch the right click by if e.Button == System.Windows.Forms.MouseButtons.Right)

    Thank you

    Friday, January 5, 2007 5:56 AM
  • You cannot detect mouse clicks outside of your own application without using Win32 APIs. Here is an example: http://www.codeguru.com/vb/gen/vb_misc/article.php/c2757/
    Friday, January 5, 2007 9:59 PM

All replies

  • You can try MouseLeave event when leave the form, in the form use MouseMove. and use the mouseDown to catch the click event (catch the right click by if e.Button == System.Windows.Forms.MouseButtons.Right)

    Thank you

    Friday, January 5, 2007 5:56 AM
  • You cannot detect mouse clicks outside of your own application without using Win32 APIs. Here is an example: http://www.codeguru.com/vb/gen/vb_misc/article.php/c2757/
    Friday, January 5, 2007 9:59 PM