You could move the cursor off the screen, but there is an easy way to make the cursor invisible with an API call:
Declare
Declare Function ShowCursor Lib "User" (ByVal bShow As Integer) As Integer
Usage
To use the API, simply call:
R = ShowCursor(True)
or
R = ShowCursor(False)
There is one thing you should know about this API call. Whenever a program calls ShowCursor, Windows keeps an internal count of how many times ShowCursor was called. The problem is that there is no way to retrieve this counter. So just calling ShowCursor(False) might not work because it just decreases the counter by one. Unless the counter is zero, the cursor will not disappear. Use this routine instead.
Sub EnableCursor (iSetting As Integer)
Select Case iSetting
Case True
Do While ShowCursor(True) <= 0
Loop
Case False
Do While ShowCursor(False) >= 0
Loop
End Select
End Sub
To use this Sub, call it with the iSetting parameter set to either True or False. The cool thing about this API call is that it makes the cursor invisible but MouseMove, etc., events still work. This technique also works in Windows 95.
This tip is reprinted from the VB Tips & Tricks Volume 1 book.
Parts of this tip was submitted by: David McCarter
Compatible with: Visual Basic 3.0, Visual Basic 4.0 16-bit
Discover more from dotNetTips.com
Subscribe to get the latest posts sent to your email.
