Jump to content
  • Advertisement
Sign in to follow this  
stylin

:solved: Mousewheel Events in WinXP Console

This topic is 4844 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

From INPUT_RECORD.Event.MouseEvent.dwButtonState; INPUT_RECORD.EventType == MOUSEWHEELED :
00000000 01111000 00000000 00000000 (mousewheel up)
11111111 10001000 00000000 00000000 (mousewheel down)
Does anybody know what these bits mean in relation to the wheel? Why are they using an entire byte and a bit from another, given that events from the wheel only indicate if movement occurred, rather than how much? Thanks to anybody who can shed some light on this for me. :stylin: [Edited by - stylin on August 16, 2005 2:06:45 AM]

Share this post


Link to post
Share on other sites
Advertisement
The MSDN doesnt make it sound like it means anything. I would ignore it and just use FROM_LEFT_1ST_BUTTON_PRESSED and friends when dealing with dwButtonState.

Share this post


Link to post
Share on other sites
Well, I can use the information for wheel events, but I'd like to make it forward compatible. MSDN gives the MOUSE_WHEELED event validity for WinXP, but how can I correctly determine the direction?

:stylin:

Share this post


Link to post
Share on other sites
This looks like the value you get in wparam of the WM_MOUSEWHEEL message. You get the number of "ticks" the wheel was scrolled multiplied by a system wide parameter (usually 120). The value is in the upper 16 bit of the dword.

The lower value is negative, hence the set bits in the upper byte.

For exact explanations read up in the MSDN about WM_MOUSEWHEEL, specifically the wparam parameter.

Share this post


Link to post
Share on other sites
In Win32 if you get the WM_MOUSEWHEEL message as you are, you’ll find that
The Mouse_Wheel_Delta = ((short)HIWORD (wParam));

So in your case

00000000 01111000 00000000 00000000 (mousewheel up)
11111111 10001000 00000000 00000000 (mousewheel down)

We take the HIWORD and get.

00000000 01111000 = 120
11111111 10001000 = -120

This is equal to one delta, MS set this so that mouse manufactures could make finer scrolling in the future.

It’s defined in WinUser.H as
#define WHEEL_DELTA 120 /* Value for rolling one detent */

Share this post


Link to post
Share on other sites
@Bobason456 & Endurion: Thanks for the clarifying this for me. Initially I was confused because this word does not change with varying wheel speeds, as I originally thought it would.

:stylin:

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!