views:

19

answers:

0

I'm using .net 2.0 compact framework compiling for pocket PDAs. I need to determine how long the mouse (stylus) has been held down for. To do this I capture the WM_LBUTTONDOWN and WM_LBUTTONUP messages and record the time that i received them. Then simply put WM_LBUTTONUP time - WM_LBUTTONDOWN time should be about how long it was held down for.

The problem is the WM_LBUTTONUP message isn't always firing, I have read around that a possible cause is the mouse capture however I have tried with setting the capture i.e.

            case Win32.WM_LBUTTONDOWN:
                tmp = LeftButtonDown;
                this.Capture = true;
                break;
            case Win32.WM_LBUTTONUP:
                tmp = LeftButtonUp;
                this.Capture = false;
                break;

But it still isn't being fired properly.

So what gives?