Click to See Complete Forum and Search --> : How come this is failing to hide the mouse?
Daniel_Christie
Oct 22nd, 2000, 05:08 AM
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
kedaman
Oct 22nd, 2000, 10:37 AM
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:
'To show the cursor
Do until ShowCursor(1)>0:loop
'To hide it
Do until ShowCursor(0)<0:loop
bbosh
Oct 22nd, 2000, 07:25 PM
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.
/\/\isanThr0p
Oct 23rd, 2000, 06:13 PM
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.
kedaman
Oct 24th, 2000, 05:39 AM
Misantrop, now you are confusing me really! :confused: Doevents has nothing to do with the cursor :confused:
And bbosh, they should work uncompiled too, the problem appears when you debug the code, and you use show/hide more than one time
/\/\isanThr0p
Oct 24th, 2000, 09:42 AM
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
kedaman
Oct 24th, 2000, 04:23 PM
Hey were can i download your wormgame? :confused: "events verarbeiten" :confused: hehe i'm not good at germany
/\/\isanThr0p
Oct 24th, 2000, 05:28 PM
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!)
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.