Advertisement

WM_MOUSEWHEEL message

Started by April 08, 2000 03:58 PM
8 comments, last by Facehat 24 years, 8 months ago
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
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
Advertisement
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
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
Founder Caffeinated Gameswww.caffeinatedgames.com
The WM_MOUSEWHEEL message only works under Windows 98 by default. I don''t know if any of these suggestions work, but I do know that Windows 95 doesn''t recognize the message..

------------------------------
Jonathan Little
invader@hushmail.com
http://www.crosswinds.net/~uselessknowledge
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
Advertisement
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.
*slaps forhead*

Doh! I should have seen that. Thanks

--TheGoop
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!"

George. F"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!"
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
It's good to be an outcast, you don't need to explain what you do, you just do it and say you don't belong there.

This topic is closed to new replies.

Advertisement