Jump to content
  • Advertisement
Sign in to follow this  
iNsAn1tY

Processing mouse wheel messages...

This topic is 5408 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

Evening. I've been doing some work on input recently, and try as I might, I cannot get my app to process WM_MOUSEWHEEL messages. There must be a solution to this, as pretty much every game and app under the sun use the mouse wheel, so can anyone enlighten me? I have no problem using it under MFC, with the OnMouseWheel message handler, but Win32 doesn't seem to want to play ball on this one. Thanks in advance for any replies...

Share this post


Link to post
Share on other sites
Advertisement

case WM_MOUSEWHEEL:

zDelta = GET_WHEEL_DELTA_WPARAM(wParam);



"The high-order word indicates the distance the wheel is rotated, expressed in multiples or divisions of WHEEL_DELTA, which is 120."

Is that what you are looking for? Found it on MSDN.

Share this post


Link to post
Share on other sites
You didn't post any of your code.

Here are code snippets from one app I wrote:


#ifndef WM_MOUSEWHEEL
#define WM_MOUSEWHEEL 0x020A
#define WHEEL_DELTA 120
#endif

LRESULT CALLBACK Window::WndProc(HWND hWnd,UINT message,WPARAM wParam,LPARAM lParam)
...
switch (message) {
...
case WM_MOUSEWHEEL:
short delta=(short)HIWORD(wParam); // wheel rotation
//f+=(float)delta/WHEEL_DELTA;
...
return 0;
...



Compare this code to yours - this code works for me.

Share this post


Link to post
Share on other sites
Ah, so that's how it works. I thought I was missing an include file or something. Didn't even cross my mind to manually define WM_MOUSEWHEEL. I didn't post any code because it was just WM_MOUSEWHEEL in the switch statement in my WindowProc. Anyway, thanks for the help...

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!