Sign in to follow this  

WM_MOUSEWHEEL

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

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
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 this post


Link to post
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 this post


Link to post
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 this post


Link to post
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 this post


Link to post
Share on other sites

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

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this