For an eBook or printed book on using the API with Liberty BASIC, see: APIs for Liberty BASIC
Show or Hide the Cursor
The ShowCursor function is part of user32 DLL and it sets an internal display counter that determines whether the cursor should be displayed. The cursor is displayed only if the display count is greater than or equal to 0. If a mouse is installed, the initial display count is 0. If no mouse is installed, the display count is –1.
Syntax
The syntax for the ShowCursor function is as follows.
The bShow parameter tells the function whether to increment or decrement the display count. The return from this function is the new display count. The display count must be greater than or equal to zero for the cursor to be displayed.
Assuring Cursor Display
To assure that the cursor is displayed after a program hides the cursor, call the ShowCursor function until it returns a counter value of 0 or greater. The API ShowCursor function is wrapped in a Liberty BASIC function in the code below.
while count<0
count=ShowCursor(1)wendwaitfunction ShowCursor( bShow )'bShow =0 decrements count, =1 increments countcalldll#user32,"ShowCursor",_
bShow aslong, _
ShowCursor aslong'returns new display countendfunction
Demo
Here is a sample program. The buttons allow the user to increment or decrement the cursor count. The count is displayed in the statictext control. When the program closes, the function is called to increment the display count until the cursor is displayed.
nomainwinbutton#1.show,"Show Cursor",[show],UL,10,10,100,30button#1.hide,"Hide Cursor",[hide],UL,10,50,100,30statictext#1.s,"Cursor Count",130,10,300,100open"Cursor Display Demo"forwindowas#1#1"trapclose [quit]"wait[quit]'assure that cursor is displayed'cursor count must be >=0while count<0
count=ShowCursor(1)wendclose#1:end[show]
count=ShowCursor(1)#1.s "Cursor Count is ";count
wait[hide]
count=ShowCursor(0)#1.s "Cursor Count is ";count
waitfunction ShowCursor( bShow )'bShow =0 decrements count, =1 increments countcalldll#user32,"ShowCursor",_
bShow aslong, _
ShowCursor aslong'returns new display countendfunction
Show or Hide the Cursor | Syntax | Assuring Cursor Display | Demo
Some text below is copied from the Microsoft Developers Network Library.
For an eBook or printed book on using the API with Liberty BASIC, see:
APIs for Liberty BASIC
Show or Hide the Cursor
The ShowCursor function is part of user32 DLL and it sets an internal display counter that determines whether the cursor should be displayed. The cursor is displayed only if the display count is greater than or equal to 0. If a mouse is installed, the initial display count is 0. If no mouse is installed, the display count is –1.Syntax
The syntax for the ShowCursor function is as follows.The bShow parameter tells the function whether to increment or decrement the display count. The return from this function is the new display count. The display count must be greater than or equal to zero for the cursor to be displayed.
Assuring Cursor Display
To assure that the cursor is displayed after a program hides the cursor, call the ShowCursor function until it returns a counter value of 0 or greater. The API ShowCursor function is wrapped in a Liberty BASIC function in the code below.Demo
Here is a sample program. The buttons allow the user to increment or decrement the cursor count. The count is displayed in the statictext control. When the program closes, the function is called to increment the display count until the cursor is displayed.