Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cursor

Status
Not open for further replies.

gamechampionx

Programmer
Jan 26, 2002
14
0
0
CA
How do you make the cursor disappear in VB6?
 
HOw does that work? It looks like C++ code, won't work when I run it. Do you have to declare thet before using it somehow (not declared error shows up)?
 
Private Declare Function ShowCursor Lib "user32" (ByVal bShow As Long) As Long
Private Sub Form_Load()
'KPD-Team 1998
'URL: 'E-Mail: KPDTeam@Allapi.net
'Hide the cursor
ShowCursor 0
'Wait 10 seconds
t = Timer
Do: DoEvents: Loop Until Timer > t + 10
'Show the cursor
ShowCursor 1
End Sub
 
How do you use that? Where do you type that, and how do you call it? Is there a simpler way of doing it?
 
Add this line to the declarations section of your form (or declare it as Public in a module):
Private Declare Function ShowCursor Lib "user32" (ByVal bShow As Long) As Long

Then, anywhere in your code
'To hide the cursor (this is a comment)
ShowCursor 0
'To show the cursor again (this is also a comment)
ShowCursor 1

So it becomes a one-liner. How much simpler do you want it to be? Did you read Justin's tip (or paste it into a form module)?

Good Luck :)
Andy
 
Where in your code have you put either:
Private Declare Function ShowCursor Lib "user32" (ByVal bShow As Long) As Long
(declaration for form)
Or:
Public Declare Function ShowCursor Lib "user32" (ByVal bShow As Long) As Long
(declaration for bas)
?

It must be declared somewhere, and with scope that is applicable to your usage. ie If you only want to use it on 1 form then declare it as Private in the declarations section of the form. If you want to use it in procedures on multiple forms (or in modules) then declare it as Public in a bas.

Andy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top