winapic++builderc++builder-2010

How do I make the mouse cursor invisible?


I have a C++Builder application in which I need to make the mouse cursor invisible. How can I do this?

I think it can be done using the Win32 API, but I don't know exactly how.


Solution

  • Call ShowCursor(FALSE). If you need to restore the cursor later, call ShowCursor(TRUE).

    Note that the cursor visibility is reference counted so you need to match every call passing FALSE to one passing TRUE.

    This function sets an internal display counter that determines whether the cursor should be displayed. The cursor is displayed only if the display count is greater than or equal to 0. If a mouse is installed, the initial display count is 0. If no mouse is installed, the display count is –1.