“Hiding” System Cursor

对着背影说爱祢 提交于 2019-11-29 08:12:21

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

CS Koh

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);
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!