Results 1 to 8 of 8

Thread: How come this is failing to hide the mouse?

  1. #1

    Thread Starter
    Addicted Member Daniel_Christie's Avatar
    Join Date
    Jan 2000
    Location
    USA
    Posts
    245
    How come my following code is failing to hide the mouse?
    Everything else is triggering?



    Private Declare Function ShowCursor Lib "user32" (ByVal bShow As Long) As Long
    Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer

    Private Sub Form_Load()
    Dim tray&

    'Hide Taskbar
    tray& = findwindow("Shell_TrayWnd", vbNullString)
    x = showWindow(tray&, SW_HIDE)

    'Hide Mouse Cursor
    ShowCursor 0

    'Start the Timer to watch for key Presses
    tmrVisible.Enabled = True
    End Sub

    Private Sub Form_Terminate()
    Unload Me
    End Sub

    Private Sub Form_Unload(Cancel As Integer)
    'Show Taskbar
    tray& = findwindow("Shell_TrayWnd", vbNullString)
    x = showWindow(tray&, SW_SHOW)
    'Show Mouse Cursor
    ShowCursor 1
    Unload Me
    End Sub

    Private Sub tmrVisible_Timer()
    'Check whether the ((Shift) + (Numeric pad's +)) keys have been pressed.
    'If they have been pressed then Return System Functions to normal.
    If (GetAsyncKeyState(&H10)) And (GetAsyncKeyState(&H6B)) Then
    Unload Me
    End If
    End Sub

  2. #2
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Only thing i can think of that is you have used showcursor 1, two times and then didn't hide the second time, duing to some debugging. here's how you can avoid such:
    Code:
    'To show the cursor
    Do until ShowCursor(1)>0:loop
    'To hide it
    Do until ShowCursor(0)<0:loop
    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.

  3. #3
    Addicted Member bbosh's Avatar
    Join Date
    Oct 2000
    Location
    Hell (AKA New Mexico)
    Posts
    186
    Code:
    Private Declare Function ShowCursor Lib "user32" (ByVal bShow As Long) As Long 
    Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer 
    Dim X as Long
    
    Private Sub Form_Load() 
    Dim tray& 
    
    'Hide Taskbar 
    tray& = findwindow("Shell_TrayWnd", vbNullString) 
    x = showWindow(tray&, SW_HIDE) 
    
    'Hide Mouse Cursor 
    X = ShowCursor (False)
    
    'Start the Timer to watch for key Presses 
    tmrVisible.Enabled = True 
    End Sub 
    
    Private Sub Form_Terminate() 
    Unload Me 
    End Sub 
    
    Private Sub Form_Unload(Cancel As Integer) 
    'Show Taskbar 
    tray& = findwindow("Shell_TrayWnd", vbNullString) 
    x = showWindow(tray&, SW_SHOW) 
    'Show Mouse Cursor 
    X = ShowCursor (True)
    Unload Me 
    End Sub 
    
    Private Sub tmrVisible_Timer() 
    'Check whether the ((Shift) + (Numeric pad's +)) keys have been pressed. 
    'If they have been pressed then Return System Functions to normal. 
    If (GetAsyncKeyState(&H10)) And (GetAsyncKeyState(&H6B)) Then 
    Unload Me 
    End If 
    End Sub
    ShowCursor, like always on top routines only work when the application has really been compiled and run, not within VB.
    Brian
    Programming: VB5 Pro (SP3) - QBasic 1.1,4.5
    Internet: HTML 4, CSS, JavaScript
    Visit AltInt.com!

  4. #4
    Frenzied Member /\/\isanThr0p's Avatar
    Join Date
    Jul 2000
    Location
    They can't stop us! We're on a misson from God.
    Posts
    1,181
    bbosh, that's not exactly right. I often had to mess around with an invisble cursor during debugging, so I always used the immediat window to make the cursor visible again. I experienced the problem that it sometimes doesn't hide the cursor. When I put a doevents in the mainloop it hided, if I didn't it didn't hide!!! Even though I did a
    do
    doevents
    loop
    I don't remember what I uses to exit the loop.


    Sanity is a full time job

    Puh das war harter Stoff!

  5. #5
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Misantrop, now you are confusing me really! Doevents has nothing to do with the cursor

    And bbosh, they should work uncompiled too, the problem appears when you debug the code, and you use show/hide more than one time
    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
    Frenzied Member /\/\isanThr0p's Avatar
    Join Date
    Jul 2000
    Location
    They can't stop us! We're on a misson from God.
    Posts
    1,181
    Keda!!! THAT CONFUSED ME TOO!!!

    Especially the Doevents on a total different place in the program!!!!
    Just download my wormgame and scroll down in the menu. There is something like "events verarbeiten". That means do events. You can put it "ein" on, or "aus" off.
    Just look at it!! all this option does is switching off the doevents in the mainloop
    Sanity is a full time job

    Puh das war harter Stoff!

  7. #7
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Hey were can i download your wormgame? "events verarbeiten" hehe i'm not good at germany
    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.

  8. #8
    Frenzied Member /\/\isanThr0p's Avatar
    Join Date
    Jul 2000
    Location
    They can't stop us! We're on a misson from God.
    Posts
    1,181
    Don't laugh about my page, shortly after I uploaded it (the first part) my trialversion of cuteFTP expired!!
    And I'm lazy and nobody really needs my page, ti is just designed to give some friends I get to know on the internet the posibility to download my game.
    When I just wrote this I really decided that my freaking page isn't good enough for this forum, and I don't want to get a worse reputation! I'll send you the direct link to the zip file. (I hope it is the version that acted that strange, cause after playing around with the cooperative levels I got it to work!)
    Sanity is a full time job

    Puh das war harter Stoff!

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