Hiding and Displaying the Mouse Cursor in Visual Basic
Tutorial Description - Hiding and Displaying the Mouse Cursor in Visual Basic
This quick tutorial shows you how to hide and show the mouse cursor in Visual Basic.
Hiding and Displaying the Mouse Cursor in Visual Basic
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