I'm trying to use WM_MOUSEWHEEL for something very simple -- I simply want to check if the wheel has moved up or down; not how far. I've looked on MSDN, and googled it; but to no avail - I still can't figure out how to do it.
Could someone please demonstrate how you would evaluate whether the mouse had moved up or down? I'm trying to write a function to increase or decrease hue on a colour via the mouse wheel; this is the code I have so far:
void wmMouseWheel(HWND hWnd, WPARAM wp, LPARAM lp) {
bool up, down;
if (up) {
if (red) {
r += 5;
g += 1;
b += 1;
} elseif (green) {
r += 1;
g += 5;
b += 1;
} elseif (blue) {
r += 1;
g += 1;
b += 5;
} else {
r += 3;
g += 3;
b += 3;
}
} elseif (down) {
if (red) {
r -= 5;
g -= 1;
b -= 1;
} elseif (green) {
r -= 1;
g -= 5;
b -= 1;
} elseif (blue) {
r -= 1;
g -= 1;
b -= 5;
} else {
r -= 3;
g -= 3;
b -= 3;
}
} else {
return;
}
}
"r", "g", and "b" are integers being used for RGB() values thus:
case'R':
red = true;
r = 255;
g = 0;
b = 0;
color = RGB(r, g, b);
break;
case'G':
green = true;
r = 0;
g = 255;
b = 0;
color = RGB(r, g, b);
break;
case'B':
blue = true;
r = 0;
g = 255;
b = 0;
color = RGB(r, g, b);
break;
"red", "green" and "blue" are booleans to decide what to in-/decrease.
All I want to know how to do is judge whether the mousewheel has been moved up or down.
Use the GET_WHEEL_DELTA_WPARAM Macro on the wParam, a positive indicate the wheel is rotated away from the user (up) and a negative indicates a rotation towards the user (down)