“Hiding” System Cursor

后端 未结 2 416
陌清茗
陌清茗 2020-12-18 12:16

BACKGROUND:

  • I\'m trying to create a \"mouse hiding\" application that hides the user\'s mouse from the screen after a set amount of time.
  • I\'ve trie
相关标签:
2条回答
  • 2020-12-18 12:36

    I found a good workaround for hiding system cursor temporarily that doesn't involve screwing around with setsystemcursor().

    SetSystemCursor() is dangerous, because if the app crashes or otherwise throws a bug, the cursor will be changed permanently until the next reboot.

    Instead, I implemented a transparent window over the whole desktop, and that window hides the cursor when needed. The method to use is ShowCursor from Win32.

    The transparent window can be something like this: http://www.codeproject.com/Articles/12597/OSD-window-with-animation-effect-in-C

    [DllImport("user32.dll")]
    static extern int ShowCursor(bool bShow);
    
    ShowCursor(false);
    
    0 讨论(0)
  • 2020-12-18 12:41

    One application can't affect another applications cursor. You'd have to write a mouse driver of some sort in order to do this.

    0 讨论(0)
提交回复
热议问题