WM_MOUSEWHEEL

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:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
void wmMouseWheel(HWND hWnd, WPARAM wp, LPARAM lp) {
    bool up, down;
    if (up) {
        if (red) {
            r += 5;
            g += 1;
            b += 1;
        } else if (green) {
            r += 1;
            g += 5;
            b += 1;
        } else if (blue) {
            r += 1;
            g += 1;
            b += 5;
        } else {
            r += 3;
            g += 3;
            b += 3;
        }
    } else if (down) {
        if (red) {
            r -= 5;
            g -= 1;
            b -= 1;
        } else if (green) {
            r -= 1;
            g -= 5;
            b -= 1;
        } else if (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:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
            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.

Thanks.
closed account (z05DSL3A)

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)


GET_WHEEL_DELTA_WPARAM http://msdn.microsoft.com/en-us/library/ms646254(VS.85).aspx
Thanks =]
Topic archived. No new replies allowed.