Jump to content
  • Advertisement
Sign in to follow this  
web383

Capturing Win32 Mouse Repeat Events

This topic is 1879 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Is it possible to receive WM_LBUTTONDOWN auto repeat events similar to WM_KEYDOWN with the standard repeat delay?

 

I'm working on a GUI, and would like to mimic scrollbars and repeat buttons much like the widgets in a C# WinForms application.  I was hoping this would be possible without implementing a custom timer and handling it manually.

Share this post


Link to post
Share on other sites
Advertisement

I did try that, and my mouse clicks don't seem to be triggering a WM_KEYDOWN message.  Should they be?  Or can VK_LBUTTON only be queried through GetKeyState() and GetAsyncKeyState()?

Share this post


Link to post
Share on other sites

Windows will only send a single message when a mouse button is pressed and held, but it will send multiple (repeat) WM_KEYDOWN messages when a key on the keyboard is pressed and held. So yes, your scrollbar widget will have to use timers (or some other mechanism for performing an action with a certain frequency) to mimic the standard scrollbar behavior. But using Windows' timers is not difficult at all, so I don't see why you would want to avoid them.

Share this post


Link to post
Share on other sites

Thanks for the replies.  This is exactly the behavior I've encountered.  Using a timer isn't an issue at all, I was mostly curious if it was possible otherwise.

 

I'm also using SystemParametersInfo() with SPI_GETKEYBOARDDELAY and SPI_GETKEYBOARDSPEED to query the initial delay and repeat speeds of the keyboard settings, and just applying it to a custom mouse-down repeat event.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!