Skip to main content
GameDev.net gamedev.net
🔒 Locked

Hiding mouse cursor

Started by ibolcina Dec 29, 2002 at 1:01 PM 0 replies 350+ views
Original Post
ibolcina
ibolcina
Hi. I want to hide mouse cursor on my Directx game window. I have done this case WM_SETCURSOR: SetCursor(NULL); device->ShowCursor(FALSE); return TRUE; In 99% of startups, cursor is hidden. But in 1% cases, the cursor remains shown until mouse is moved. How to correctly do this?
Alan Kemp
Alan Kemp
I am not exactly certain this is the "correct" way to do it, but just after I create my window I call:


  
RECT r;
r.top = WindowX;
r.bottom = r.top + WindowHeight;
r.left = WindowY;
r.right = r.left + WindowWidth;
ClipCursor(&r);
ShowCursor(false);


You may or may not need the clipcursor stuff, I use it otherwise in windowed mode the mouse can go off the edge of your window and becomes visible again.

Alan
"There will come a time when you believe everything is finished. That will be the beginning." -Louis L'Amour

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.