how can i test if the wheel move was negative or positive?
i belive these detect the mouse position:

xPos = GET_X_LPARAM(lParam); 
yPos = GET_Y_LPARAM(lParam);

but how can i test if any key(like alt\control\shift) was pressed?
(i'm talking in same message)

3 Years
Discussion Span
Last Post by cambalinho

The example code is MFC (Microsoft Foundation Class), which is VC++ c++ class. But the explanation about the mousewheel would apply to any compiler that uses win32 api functions.


I use this to find out direction and amount of mousewheel movement.

// This ikWheelDelta will be a number like +1 or -2
const int ikWheelDelta = GET_WHEEL_DELTA_WPARAM(pMsg->wParam)/WHEEL_DELTA ;

This is called in PreTranslateMessage for your window.


owenransen thanks but read these:

The high-order word indicates the distance the wheel is rotated, expressed in multiples or factors of WHEEL_DELTA, which is set to 120. A positive value indicates that the wheel was rotated to the right; a negative value indicates that the wheel was rotated to the left.

The low-order word indicates whether various virtual keys are down. This parameter can be one or more of the following values."

like you see theres another way ;)
but thanks for all

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.