[win32] - how can track the Mouse Stoped event\message?

can anyone advice me for track the Mouse Stoped message?
i have 1 idea, but my thot isn't completed :(
- using 2 static variables for see the mouse positions;
- when the mouse move we kill the timer and, then i recreate the timer for test the mouse coordenates;
-using the WM_TIMER, i compare the values.

can anyone advice me on these thot, please?

these code wasn't tested, but tell me something:
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
//outside of switch:
static int xPos=0;
        static int yPos=0;
        static UINT_PTR timerid;

case WM_MOUSEMOVE:
            {
                KillTimer(hwnd,timerid);
                xPos = GET_X_LPARAM(lParam);
                yPos = GET_Y_LPARAM(lParam);
                inst->MouseMove(MBButtons, blControl, blShift, xPos, yPos);                
                if (!Tracking)
                {
                    TrackMouse(hwnd,(long)inst->intMouseHover);
                    Tracking = true;
                    inst->MouseEnter();
                }
                SetTimer(hwnd,timerid,100,NULL);
            }
break;
            case WM_TIMER:
            {
                if (wParam ==timerid)
                {
                    KillTimer(hwnd,timerid);
                    inst->MouseStoped();                    
                }
            }
            break;
Last edited on
here is a modified version of your code which might help you going on the right track... since it seems you get the idea. to bad there is no WM_MOUSESTOP...

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
            POINT PreviousLocation, Location;

            case WM_MOUSEMOVE:
            {
                KillTimer(hwnd,timerid);
                PreviousLocation = Location;
                GetCursorPos(&Location);
                inst->MouseMove(MBButtons, blControl, blShift, Location.x, Location.y);                
                if (!Tracking)
                {
                    TrackMouse(hwnd,(long)inst->intMouseHover);
                    Tracking = true;
                    inst->MouseEnter();
                }
                SetTimer(hwnd,timerid,100,NULL);
            }
            break;

            case WM_TIMER:
            {
                if (wParam ==timerid)
                {
                    PreviousLocation = Location;
                    GetCursorPos(&Location);
                    if ((Location.x == PreviousLocation.x) && (Location.y == PreviousLocation.y))
                    {
                           KillTimer(hwnd,timerid);
                           inst->MouseStoped();
                     }
                }
            }
            break;
thanks
if there is a WM_EXITSIZEMOVE why they never did the WM_MOUSESTOPED and the drag messages?
sorry the code isn't working, because the MouseStoped seems not be activated :(
is activated so fast that the text is quickly changed lol
Last edited on
the problem isn't your code, but my label for change the text :(
but i will try fix that.. thanks
make sure that POINT PreviousLocation, Location; is defined as data members for the class containing the WndProc if your WndProc was inside a class...

or in cause your WndProc was not in a class place the POINT PreviousLocation, Location; on top of your cpp file as a global variable.

Edit : what I mean is that PreviousLocation and Location need to be defined outside WndProc and accessable from within it.
Last edited on
i put them static ;)
the problem isn't your code.... i belive that it's my label. i must avoid somethings for try avoid very flickers and more lol
like if the previous text it's the same, why change it... somthings like that ;)
thanks for all
Topic archived. No new replies allowed.