Results 1 to 4 of 4

Thread: ShowCursor and IDE

  1. #1
    sunnyl
    Guest

    ShowCursor and IDE

    I'm using simple ShowCursor to show/hide the mouse in my game:

    VB Code:
    1. 'hide
    2.     Do While ShowCursor(0) >= 0
    3.         DoEvents
    4.     Loop
    5.  
    6.     'show
    7.     Do While ShowCursor(1) < 0
    8.         DoEvents
    9.     Loop

    But theres a problem showing the cursor again. When I get back to the VB IDE the mouse isn't visible, but everywhere else (anywhere outside the VB IDE) it is visible.


  2. #2
    Guru Aaron Young's Avatar
    Join Date
    Jun 1999
    Location
    Red Wing, MN, USA
    Posts
    2,177
    It sounds like the code you use to Show the cursor again isn't getting called, this could be because you use the IDE Stop functionality to stop your app instead of closing the Form, or you call End somewhere in your form instead of Unload Me.

  3. #3
    sunnyl
    Guest
    Thanks for the idea...but that wasn't it. The program is DirectX based running at full screen, and the order I unload in is

    1. show cursor
    2. unload directx
    3. end

    And I'm pretty sure it's executing, as I once commented out the showing code and the cursor didn't show at all.

  4. #4
    jenk
    Guest

    this works for me...

    Private Sub MouseCursor(Mstate As Boolean)
    Dim ret As Long

    If Mstate = False Then
    'turn off
    Do
    ret = ShowCursor(False)
    Loop Until ret < 0

    Else
    'turn on
    Do
    ret = ShowCursor(True)
    Loop Until ret > -1

    End If
    'update
    CursorState = Mstate

    End Sub

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