PDA

Click to See Complete Forum and Search --> : Invisible Mouse


gwdash
Aug 14th, 2000, 11:18 AM
How do i make the mouse invisible for my program? I runs at full screen.

Aug 14th, 2000, 11:31 AM
See your other thread (http://forums.vb-world.net/showthread.php?threadid=26426)

Mad Compie
Aug 17th, 2000, 12:31 PM
You can use the ShowCursor() API, but a more simple solution is to create a cursor "NOTHING.CUR" with nothing in it. Apply it in the Windows Configuration Screen\Mouse and your mousie will be no longer visible!

Aug 17th, 2000, 06:27 PM
Originally posted by Mad Compie
You can use the ShowCursor() API, but a more simple solution is to create a cursor "NOTHING.CUR" with nothing in it. Apply it in the Windows Configuration Screen\Mouse and your mousie will be no longer visible!

I don't have that cursor, but why would you want to make it totally invisible? That'll screw you up a lot because you won't know where the mouse pointer is. The best time to use the ShowCursor() Api should only be used for a screen saver, or your form only. Anything else and that would definitly irriatate or piss (can I say that?) someone off.

kedaman
Aug 18th, 2000, 12:52 PM
Well, ClipCursor does the trick

'In a module
Declare Function ShowCursor Lib "user32" (ByVal bShow As Long) As Long
Declare Function ClipCursor Lib "user32" (lpRect As Any) As Long

Property Let MouseVisible(newval As Boolean)
Dim TRect1 As RECT
Select Case newval
Case False 'To disable the mouse
With TRect1
.Left = 0: .Top = 0: .Right = 1: .Bottom = 1
End With
ClipCursor TRect1
ShowCursor False
Case True 'To enable the mouse
ClipCursor 0
ShowCursor True
End Select
End Property
'in code
'To disable
MouseVisible = False
'to get mouse back
MouseVisible = True

Aug 18th, 2000, 01:18 PM
All you need is this:

'Make it visible
ShowCursor 1

'Make it invisible
ShowCursor 0

Mad Compie
Aug 18th, 2000, 02:13 PM
The ShowCursor() API is only usefull in a certain application. If Windows enters the Standby-Suspend modus, the cursors appears again!
The NULL.CUR cursor is indeed interesting if you are using an embedded PC, with a touch panel (like in a kiosk, the user don't really want to see the cursor...)

kedaman
Aug 18th, 2000, 08:31 PM
The thing with Clipcursor is, that you don't click around on stuff when you don't see the cursor. So by setting the rect to the topleft corner you can't click on anything hazardous

Joacim Andersson
Aug 21st, 2000, 08:13 AM
When you call ShowCursor you are actually incrementing (if you pass True) or decrementing (if you pass False) the internal display counter by one.
So if you call ShowCursor(False) twice you have to call ShowCursor(True) twice to show the cursor again.
So you should always check the return value of ShowCursor. If the return value is less then zero the mouse pointer is hidden and if the return value is zero or above the cursor is visible.
The internal display counter is set to zero at system startup if a mouse is present, otherwise it's set to -1.

kedaman
Aug 21st, 2000, 01:42 PM
Good point Joacim, so here's how it should look like

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

Property Get CursorVisible() As Boolean
CursorVisible = -ShowCursor(True)
ShowCursor (False)
End Property
Property Let CursorVisible(Newvalue As Boolean)
Do While ShowCursor(Newvalue) * Sgn(Newvalue + 0.5) > 0
Loop
End Property