:solved: Mousewheel Events in WinXP Console

Started by
5 comments, last by stylin 18 years, 8 months ago
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]
:stylin: "Make games, not war.""...if you're doing this to learn then just study a modern C++ compiler's implementation." -snk_kid
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.
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:
:stylin: "Make games, not war.""...if you're doing this to learn then just study a modern C++ compiler's implementation." -snk_kid
I dont see any information on the MSDN that tells you how to get that information. You might now be able to.
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.

Fruny: Ftagn! Ia! Ia! std::time_put_byname! Mglui naflftagn std::codecvt eY'ha-nthlei!,char,mbstate_t>

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 */
@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:
:stylin: "Make games, not war.""...if you're doing this to learn then just study a modern C++ compiler's implementation." -snk_kid

This topic is closed to new replies.

Advertisement