Archived

This topic is now archived and is closed to further replies.

Facehat

WM_MOUSEWHEEL message

Recommended Posts

I was trying to use the WM_MOUSEWHEEL message in my map editor, but VC++ claimed it didn''t exist. But I''m pretty sure it does exist as it''s discussed in the MSDN help file . Do I need to get a new version windows.h to use it? (where I''m assuming it''s declared). And if so, where might I find this new version of the file? BTW, I''m using VC++6 (service pack 2). Thanks for any help --TheGoop

Share this post


Link to post
Share on other sites
Dig some in the windows include files (winuser.h) and you will eventually find something that says:


#if (_WIN32_WINNT >= 0x0400) // (_WIN32_WINDOWS > 0x0400)
#define WM_MOUSEWHEEL 0x020A
...
#endif


This happend to me too (other define though).
Solution: define _WIN32_WINDOWS to a proper value or simply define WM_MOUSEWHEEL.
I have no idea why it doesn't work though (Yes, I do have the proper windows version).

"Paranoia is the belief in a hidden order behind the visible." - Anonymous

Edited by - Staffan on 4/8/00 6:39:06 PM

Share this post


Link to post
Share on other sites
Hmm, I searched for that line in WinUser.h but it didn''t appear. The problem is that I need the GET_WHEEL_DELTA_WPARAM macro to decipher the data WM_MOUSEWHEEL sends me. Apparently I''ll have to get some new windows header files. Would those be in the Platform SDK?

--TheGoop

Share this post


Link to post
Share on other sites
To get it working i had to do this i''m not sure why they don''t just have it enabled.

//To enable it define this
#ifndef WM_MOUSEWHEEL
#define WM_MOUSEWHEEL 0x020A
#endif

//Use it like this
if(msg.message==WM_MOUSEWHEEL)
{
zDelta = (short) HIWORD(msg.wParam);
if(zDelta > 0)
{
//roll direction
//do whatever you want
}
if(zDelta < 0)
{
//roll other direction
//do whatever you want
}
}

Hope this helps.

--Fuel

Share this post


Link to post
Share on other sites
I''ve gotten it to intercept the WM_MOUSEWHEEL message OK now, but I can''t figure out how to find how much it rolled (i.e the delta).

I tried taking the HIWORD of the wParam like someone suggested, but that doesn''t seem to work: It gives me a 120 as the delta when I move the wheel up (as expected), but when I move the wheel down it gives me 65,416 -- which is just plain odd.

Any ideas?

--TheGoop

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
TheGoop, It seems that you just overlooked to cast WORD variable to SHORT one. The delta you receive when mouse wheel was moved is signed. It gives you -120 not 65,416

Kwanji - a game developer in Japan.

Share this post


Link to post
Share on other sites
Confirming what Qoy said:

The network in my college uses Win95, and the MouseWheels work only on computers that have a program running in the taskbar.

George.

"Who says computer games affect kids, imagine if PacMan affected us as kids, we'd all sit around in a darkened room munching pills and listening to repetitive music....uh oh!"

Share this post


Link to post
Share on other sites
hi

how do i get if the mousewheel was pressed ?? (mine mouse allows it) i think its called mouse button 3 but the messagesa are only LMOUSEDOWN RMOUSEDown

thks

Share this post


Link to post
Share on other sites