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
Back to the index.


Go to Paul Kuliniewicz's Home Page.
E-mail: rogue953@hotmail.com
This page is at http://skyscraper.fortunecity.com/transmission/45/api/s/showcursor.html