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)

Recommended Answers

All 7 Replies

Here is a good tutorial that explains exactly what you are looking for.

Did you read the article I posted? Or did you just dismiss it because it had too many words?

ok.. i was seen better: is that Visual C++?

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.