Jump to content
Sign in to follow this  

Capture a mouse click

Recommended Posts


I would like my script to capture when someone clicks the mouse and run a certain function.

I recall a while back using windows notifications to do some neat things with controls and I thought I remembered

there were some constants that defined the mouse buttons etc. Whenever I needed to mess with the Windows API

in the past I would use an old link to the MSDN site where it listed all the messages/notifications and I could usually

figure it out. However, that link is apparently out of date now and I was getting frustrated trying to find the info. Is there

a better site to go through the windows notifications etc than the MSDN site?? If so, please share.

Any ideas to help accomplish the above would be greatly appreciated.

Share this post

Link to post
Share on other sites

I'm not sure about WM, but you could use _IsPressed() for the left button click, and MouseGetPos(), write it to a file.

Edit: I'll try to make an example, I've always wondered if that would work, I'll try.

Edited by JustinReno

Share this post

Link to post
Share on other sites

Well I tried the _Ispressed() function and it does capture the mouseclick and run my function. Thank you for that. However, I noticed that

it still performs the actual mouse click wherever the mouse happens to be. I wonder if there is a way to have the mouse

click run my function but not actually perform a real click??

I am working with a person with a disability that would like to use the touchpad on her laptop to simulate the pressing of the

spacebar. The Ispressed() method would allow me to press the spacebar via a function but the blinking caret (in a word processor) would be relocated to wherever the

mouse pointer was located since an actual click will still be performed. This could get messy since the blinking caret would be constantly re-located to where the

mouse pointer is located.

Any further ideas???

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.