Search code examples
.netwindowsservicecursor

Windows changing cursor when moving quickly


Hello i have no idea how to code this, but i'd like to create some app for Windows 10 that run behind.

It would increase the size of the cursor when u'r moving ur mouse really fast.

The feature comes from osX.

Does somebody know if it is possible in windows , .NET , or something ? and enlighten me ?


Solution

  • I don't know at this time if there's a way to do it purely with managed code (.NET), but I'm not a windows developer, so probably a better approach may exist. Anyway, if I would make such a thing, I would do the following:

    Track the mouse movements and compute the distance

    The User32.dll provides a function called GetMouseMovePointsEx, that can be used to retrieve the, at most, the last positions [at most 64] of the mouse, including respective timestamps. Based on the timestamps and positions, it'll be easy to compute how fast the mouse moved and decide if you need to invoke the next step "Change the mouse cursor image, globally".

    I don't really know if such a function exists on .NET. Anyway, if nothing as handy as GetMouseMovePointsEx exists, you can always [DllImport()] it into your .NET application.

    Change the mouse cursor image, globally

    You may want to give a look at this question and respective accepted answer. Again, not a purely managed code solution, but the required import from User32.dll is present in the example.

    Create a Windows Service (running the application in the background)

    MSDN contains a decent article documenting that. It also contains the steps to install the service, start it, etc.

    Final thoughts

    I guess that these are the major 3 challenges that you've ahead of you. I hope it's enough for you to perform further research.