如何全局隐藏和禁用光标? [英] How to hide and disable cursor globally?

查看:54
本文介绍了如何全局隐藏和禁用光标?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个问题:

  1. 如何隐藏所有程序的光标?我试图通过使用隐藏光标ShowCursor,但它只适用于我的程序.移动时光标仍然出现光标在我的程序之外.
  2. 如何禁用所有程序的鼠标操作? 我使用 SetWindowsHookEx 来钩住鼠标并阻止其他程序处理鼠标操作.我可以勾住点击,但问题是我无法勾住移动".当我将鼠标移动到菜单或系统按钮(最小化/恢复/关闭")时,它们会突出显示.这意味着他们仍然可以看到"鼠标.
  1. How to hide cursor for all programs? I tried to hide the cursor by using ShowCursor, but it only works in my program. The cursor still appears when moving cursor outside of my program.
  2. How to disable mouse operations for all programs? I use SetWindowsHookEx to hook mouse and prevent other programs to processing the mouse operations. I can hook the clicks, but the problem is that I can't hook the "move". When I move the mouse to menu or system buttons ("minimize/restore/close"), they are highlighted. This means they can still "see" the mouse.

有人可以帮我吗?

推荐答案

我不知道您要做什么,但最简单的方法是使用 SetCaptureReleaseCapture 当您的应用在前景中有一个窗口.您还可以使用 ClipCursor(RECT *) 以确保光标停留在您控制的窗口中.

I shudder to wonder what you are trying to do, but the easiest way to do this, assuming you have an otherwise well behaving application, is to use SetCapture and ReleaseCapture when your app has a window in the foreground. You can also use ClipCursor(RECT *) to ensure that the cursor stays in a window under your control.

这篇关于如何全局隐藏和禁用光标?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆