当前位置: 动力学知识库 > 问答 > 编程问答 >

c# - Take control of mouse using mouse hooks in VC#

问题描述:

is there any way to take control of all the mouse events entirely using mouse hooks? I'm developing an application (VC# exe that is) and I've to fulfill the following requirement: Whenever the application is active, it has to display a virtual cursor instead of the windows cursor and when the user tries to move the mouse, the mouse events have to be transferred to this virtual cursor instead of the windows cursor. So, lets say when the user moves the mouse, the virtual cursor should move instead of the windows cursor.

I've tried to implement this by giving WH_MOUSE as the hook id in SetWindowsHookEx() call, but the problem is that along with the virtual cursor, the windows cursor is moving too.

Is there a way to fulfill my requirement? Any input will be greatly appreciated. Thanks in advance.

网友答案:

Have you tried using BlockInput?
P.S: use it with care :)

分享给朋友:
您可能感兴趣的文章:
随机阅读: