# WM_MOUSEWHEEL

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

## Recommended Posts

I am having trouble getting the WM_MOUSEWHEEL event handler written so that my program will compile. Apparently WM_MOUSEWHEEL is not a constant that's been defined in any of my header files, which I find odd. The errors I'm getting are: (119): error C2065: 'WM_MOUSEWHEEL' : undeclared identifier (119): error C2051: case expression not constant I am using Microsoft Visual C++ .NET 2003. I thought that maybe I would have to update the Platform SDK, which I thought I did, but it didn't help. What I did to update the Platform SDK was the following: 1) Download the latest Platform SDK (MS Platform SDK for Windows Server 2003 SP1) from microsoft.com. 2) Install the SDK to C:\Program Files\Platform SDK 3) Overwrite the folder "C:\Programs Files\MSVS .NET 2003\VC7\PlatformSDK with the folder "C:\Program Files\Platform SDK" and rename it accordingly. It's sort of a "hack" way to do it, and might have not worked.

##### Share on other sites
This has been asked several times recently actually and there is a pretty nice fix to the problem which of course I can't remember (do a search). However all I do is replace WM_MOUSEWHEEL with 0x20a in my switch statement and that solves the problem. Again do a search for the nicer solution...

##### Share on other sites
Thanks, I'll do a search on it. I actually tried Google several times, and the MSDN, but apparently I wasn't thorough enough or didn't quite know what I was looking for. In the meantime, I'll use your hack until I find the proper solution. Works well enough for test runs!

##### Share on other sites
Ah, searching finally pays off. I present the following, for interested parties:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwui/html/BestPracticesforSupportingMicrosoftMouseandKeyboardDevices.asp
// These values must be defined to handle the WM_MOUSEHWHEEL on // Windows 2000 and Windows XP, the first two values will be defined // in the Longhorn SDK and the last value is a default value // that will not be defined in the Longhorn SDK but will be needed for // handling WM_MOUSEHWHEEL messages emulated by IntelliType Pro// or IntelliPoint (if implemented in future versions).#define WM_MOUSEWHEEL                            0x020E

##### Share on other sites
WM_MOUSEWHEEL is only defined in later versions of windows. To have the identifier defined you'll need to put the line

#define _WIN32_WINDOWS 0x501

before you include windows.h (or something like objbase.h etc) then the mouse wheel macros are defined properly and your code will compile.

##### Share on other sites
Source wins. Thanks. It turns out that my solution defining WM_MOUSEWHEEL as 0x020e didn't work anyway.

1. 1
2. 2
Rutin
26
3. 3
4. 4
JoeJ
18
5. 5
gaxio
11

• 14
• 22
• 11
• 11
• 9
• ### Forum Statistics

• Total Topics
631763
• Total Posts
3002197
×