How to hide mouse cursor?

Started by
17 comments, last by benryves 14 years, 5 months ago
Quote:Original post by CodaKiller
I can create a function which binds the mouse to a window

This is want you want to do. Use ClipCursor. And read the Remarks section! :)

Quote:but I would prefer to just disable the cursor altogether and enable it when the program closes or when focus is changed to another application.

You can't disable the cursor outright, and even if you managed to hide it globally, it still wouldn't stop it from giving input to other applications, i.e., click events.
Advertisement
I have a crazy idea that may just work, what if I were to create a small transparent window and clip the cursor to it?
Remember Codeka is my alternate account, just remember that!
I have an even crazier one, what if you were to just not mess with the cursor, unless you have a proper window to clip it to. =)
If you're trying to implement mouselook, the typical method is: upon receiving a WM_MOUSEMOVE message (or however you are notified of cursor movement over your window), calculate the cursor's deviation from the centre of your window, and then move the cursor back to that same centre.

You typically also call ShowCursor to hide the cursor while it's over your window, so it doesn't sit in the way of your crosshairs or whatever.

Combined with ClipCursor, you can be sure the cursor won't go outside of your window.

You only do this when your application is in focus, so users can ALT-TAB out (or perhaps if you can pause the game, or show a menu, you relinquish control of the cursor.)

By keeping the mouse in the centre of your application window, you get deltas which you can use to rotate your camera, while keeping the mouse cursor under control.
Maybe that is offtopic, but I remember some time ago when ZSNES crashed here in my pc, so I pressed ctrlaltdel, and got a weird stuff:
The mouse was still moving, and showing, like normal, but clicks wasnt working! Very weird and annoing, most terrible was that ZSNES was using 100% CPU and I didnt achieve to kill the ZSNES without the mouse! Yeah, sounds lame, but I still dont know how to kill a process on the task manager without the mouse, I didnt find any button to do the job...-__- lame...

>_> I pushed reset..

How can the cursor stop clicking?
Quote:Original post by Icebone1000
Yeah, sounds lame, but I still dont know how to kill a process on the task manager without the mouse, I didnt find any button to do the job...-__- lame...

You can press DELETE to kill the highlighted process.

Quote:How can the cursor stop clicking?

Never underestimate what can happen when you misuse the Win32 API :)

BTW I thought I would update you guys, my idea works fine, see for yourself: link
Remember Codeka is my alternate account, just remember that!
Quote:
You can press DELETE to kill the highlighted process.


Not to me(win2000), delete doesnt do anything here..
Quote:Original post by Icebone1000
Quote:
You can press DELETE to kill the highlighted process.


Not to me(win2000), delete doesnt do anything here..
Alt+E (note the underlined E on End Task). (May be different in Portuguese, if you're using a Portuguese copy of Windows). Alternatively, press the application key and select an item from the drop-down menu.

[Website] [+++ Divide By Cucumber Error. Please Reinstall Universe And Reboot +++]

This topic is closed to new replies.

Advertisement