Sign in to follow this  
harnacks

WM_MOUSEWHEEL Messages

Recommended Posts

harnacks    148
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
Colin Jeanne    1114
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
iNsAn1tY    476
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
harnacks    148
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
Colin Jeanne    1114
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

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