Globally hide mouse cursor in Cocoa/Carbon?

时间秒杀一切 提交于 2019-12-03 06:14:06

You are looking for CGDisplayHideCursor, which is part of the Quartz Display Services API.

just add this to your code:

CGDisplayHideCursor (kCGNullDirectDisplay);

Check out: http://developer.apple.com/legacy/mac/library/samplecode/CarbonCocoa_PictureCursor/listing2.html It's an old sample, but probably still works.

I expect that you're going to be limited to your application window, however. If you want to hide it for everyone you will probably have to make your window cover the screen.

Fun fact: The old toolbox function was simply "HideCursor()".

No, I don't believe there's a way of doing what you want, short of showing a full screen window and then obscuring absolutely everything on the desktop. That would also prevent e.g. keystrokes being sent to the right application and the like.

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