Results 1 to 10 of 10

Thread: Invisible Mouse

  1. #1

    Thread Starter
    Fanatic Member gwdash's Avatar
    Join Date
    Aug 2000
    Location
    Minnesota
    Posts
    666
    How do i make the mouse invisible for my program? I runs at full screen.
    GWDASH
    [b]VB6, Perl, ASP, HTML, JavaScript, VBScript, SQL, C, C++, Linux , Java, PHP, MySQL, XML[b]

  2. #2
    Guest
    See your other thread

  3. #3
    Fanatic Member Mad Compie's Avatar
    Join Date
    Aug 2000
    Location
    Kuurne (Belgium)
    Posts
    553
    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!

  4. #4
    Guest
    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.

  5. #5
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Well, ClipCursor does the trick
    Code:
    '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
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  6. #6
    Guest
    All you need is this:
    Code:
    'Make it visible
    ShowCursor 1
    
    'Make it invisible
    ShowCursor 0

  7. #7
    Fanatic Member Mad Compie's Avatar
    Join Date
    Aug 2000
    Location
    Kuurne (Belgium)
    Posts
    553
    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...)

  8. #8
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    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
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  9. #9
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649
    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.

  10. #10
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Good point Joacim, so here's how it should look like
    Code:
    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
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width