Version 2.0!
Features
Tutorials
Files
Glossary
Projects
Contact
Links
Message Board
Extras
LuckyCam
Old News
Sign Guestbook
View Guestbook
VB Horoscope
VB Photo Album
.
ATTENTION READERS! Lucky's VB Gaming Site is no longer active. For updated game programming information and tutorials, please visit The Game Programming Wiki!

Hiding/Displaying the Mouse Cursor

Pesky, isn't it? I hate that little cursor sometimes, and now I'm armed and ready to kill it. The scourge of mice everywhere, the bane of the arrow, it's the ShowCursor function!

Private Declare Function ShowCursor Lib "user32" (ByVal bShow As Long) As Long

This tutorial is not for the faint of heart, or the verbose... this promises to be quite short. There are only two things you need to know about this API call, how to hide the cursor, and how to show the cursor. Notice I said "hide" not destroy. The ability to click is still there, even though we remove the cursor, there is simply no longer a graphical representation.

To remove the cursor, pass 0 (that's a zero not the letter 'o') as the bShow argument. To replace the cursor, pass 1 as the bShow argument, that's it! Here's an example in case you're a slow learner :)

ShowCursor 0

That would remove the cursor! How quaint. Anyway, I have written an small program that toggles the cursor on and off, so download it if you're still confused. Check out the Files Page or click here to download now.