Public Group

# :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.

## 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 on other sites
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 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 on other sites
I dont see any information on the MSDN that tells you how to get that information. You might now be able to.

##### 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 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));

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 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:

1. 1
Rutin
49
2. 2
3. 3
4. 4
5. 5

• 10
• 28
• 20
• 9
• 20
• ### Forum Statistics

• Total Topics
633409
• Total Posts
3011719
• ### Who's Online (See full list)

There are no registered users currently online

×