# WM_MOUSEWHEEL Messages

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

## Recommended Posts

Having included Windows.h and winuser.h (which is already in windows.h) just for completeness, I am still unable to get VS6 to understand was WM_MOUSEWHEEL is. I tried adding #define WM_MOUSEWHEEL 0x020A but that doesnt seem to help matters, it gets recognized but complains of missing ';' before everything after WM_MOUSEWHEEL. Also once I get it working I know the parameter to find the mouse wheel movement is zDelta. Any idea how to extract that value and make it useable ?

##### Share on other sites
MSDN suggests this
zDelta = GET_WHEEL_DELTA_WPARAM(wParam);
anyone care to expound on that one ?

##### Share on other sites
In order to use WM_MOUSEWHEEL you need to define _WIN32_WINNT or _WIN32_WINDOWS to be greater than or equal to 0x0400. You do this before you #include windows.h like so:

#define _WIN32_WINNT 0x0400#define _WIN32_WINDOWS 0x0400#include <windows.h>

This is because WM_MOUSEWHEEL is only available on Win98+ and WinNT 4.0+. In order to use the GET_WHEEL_DELTA_WPARAM macro you need to define _WIN32_WINNT to be greater than or equal to 0x0400.

It is unfortunate that the MSDN does not explicitly tell you which macros you need to define so when I run into a constant or function that claims to be undefined I search for it in the file it lives in and look for the what I need to define myself.

##### Share on other sites
Well, all I have to support mouse wheel messages is this, directly after #include <windows.h>:

#ifndef WM_MOUSEWHEELconst DWORD WM_MOUSEWHEEL = 0x020A;const int WHEEL_DELTA = 120;#endif

Seems to work fine for me...

##### Share on other sites
I have it working now I think.. but Im having a hard time working with the wParam that defines the actual rotation.

I can't seem to turn it into a useable number. Any thoughts

Also is it possible my windows.h is out of date.. im running VS6 with win2k SP4.

##### Share on other sites
Ive managed to print out what the value is, and it seems to go from 120 to -120, in jumps rather than increments. odd.

##### Share on other sites

The reason it jumps from 120 to -120 or from -120 to 120 is because it's relative to the last position of the wheel so you'll have to keep track of what you consider the 'absolute' value to be yourself. In the future mice might be able to use smaller deltas but for now it is 120.

1. 1
Rutin
29
2. 2
3. 3
4. 4
5. 5

• 13
• 13
• 11
• 10
• 13
• ### Forum Statistics

• Total Topics
632959
• Total Posts
3009461
• ### Who's Online (See full list)

There are no registered users currently online

×