ShowCursor Function

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

Platforms: Win 32s, Win 95/98, Win NT

ShowCursor either shows or hides the mouse cursor. This is not done directly, but rather by incrementing or decrementing a counter. Each function call raises or lowers the counter by 1. If the counter is negative, the cursor is invisible. It if it non-negative, the cursor is visible. The function returns the value of the counter after changing it.

bShow
If zero, decrement the counter by 1. If non-zero, increment the counter by 1.

Example:

' Hide the mouse cursor for 5 seconds.
Dim counter As Long  ' receives value of cursor visibility counter

' Hide the cursor by decrementing the counter until it is negative
Do
  counter = ShowCursor(0)  ' decrement by 1
Loop Until counter < 0  ' keep looping until cursor is hidden

Sleep 5000  ' pause execution for 5 seconds (5000 milliseconds)

' Show the cursor by incrementing the counter until it is not negative
Do
  counter = ShowCursor(1)  ' increment by 1
Loop Until counter => 0  ' keep looping until cursor is visible

Category: Cursor

Go back to the alphabetical Function listing.
Go back to the Reference section index.


This page is copyright © 2000 Paul Kuliniewicz. Copyright Information.
Go back to the Windows API Guide home page.
E-mail: vbapi@vbapi.com Send Encrypted E-Mail
This page is at http://www.vbapi.com/ref/s/showcursor.html