WM_MOUSEWHEEL Messages

Started by
5 comments, last by Colin Jeanne 18 years, 11 months ago
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 ?
Advertisement
MSDN suggests this
zDelta = GET_WHEEL_DELTA_WPARAM(wParam);
anyone care to expound on that one ?
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.
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...
My opinion is a recombination and regurgitation of the opinions of those around me. I bring nothing new to the table, and as such, can be safely ignored.[ Useful things - Firefox | GLee | Boost | DevIL ]
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.
Ive managed to print out what the value is, and it seems to go from 120 to -120, in jumps rather than increments. odd.
If you download the newest Platform SDK from Microsoft's SDK Update your windows.h wont be out of date anymore. Unfortunately it is quite a download though.

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.

This topic is closed to new replies.

Advertisement