Jump to content
  • Advertisement
Sign in to follow this  
harnacks

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.

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

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


Link to post
Share on other sites
Advertisement
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 this post


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


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


Seems to work fine for me...

Share this post


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


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


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!