Hiding the mouse cursor

I did a search on this, but don't think I found what I was looking for.

Using VC++ 6.0, what is the mose appropriate way to hide the mouse cursor? I found one thread that would move the pointer off screen to the lower right, but wouldn't that keep the actual mouse location there? Note, I do not want to disable the mouse, or otherwise affect the  WM_MOUSEMOVE and associated message paramaters that represent the mouse location, the user will still be using the mouse, but I am capturing the movement, and rather than showing a cursor, drawing a graphical cross-hair overlay on the screen (not a cursor per say) that follows it, so I need to simply make the system mouse cursor invisible, but affect it in no other way. The overlay stuff is all working, so I just need to make the system cursor invisible (and of course be able to turn it back on as well :)

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

What about using

ShowCursor(FALSE); // hide


ShowCursor(TRUE); // show again

PMH4514Author Commented:

simple enough! I thought I'd have to use DirectX or replace it with a transparent empty bitmap or something.



Create empty cursor in the project resources. This cursor should contain only transparent background. Load this cursor using LoadCursor function:
HCURSOR hInvisibleCursor = AfxGetApp()->LoadCursor(IDC_CURSOR_INVISIBLE);

Overwrite OnSetCursor function. Of you want to make cursor invisible, call SetCursor(hInvisibleCursor) and return TRUE. If you want to show standard cursor, call base class function:
return CWnd::OnSetCursor(pWnd, nHitTest, message);

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

PMH4514Author Commented:
ShowCursor(FALSE) makes it disappear, but ShowCursor(TRUE) doesn't seem to bring it back.

You need to 'balance' the calls, i.e. if you called this API twice using FALSE, you need to call it twice using TRUE.
PMH4514Author Commented:
>> You need to 'balance' the calls
Ahh.. I see.

AlexFM's solution worked perfectly.

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
System Programming

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.