|
-
Mar 9th, 2011, 02:39 AM
#1
Thread Starter
Hyperactive Member
[RESOLVED] How to hide mouse cursor (VB6)
Hi
I'm designing a screensaver, so I was wondering how to hide the mouse cursor.
How can I do it ??(I prefer to avoid APIs so my screensaver will work on all platforms)
Thanks
H
-
Mar 9th, 2011, 08:10 AM
#2
Re: How to hide mouse cursor (VB6)
Well all the screensavers I have it uses the ShowCursor API it simple and easy to use. While you are debugging rem it out the hide else you will loose the mouse if errors crop up then back to VB. 
Code:
Option Explicit
Private Declare Function ShowCursor Lib "user32" (ByVal bShow As Long) As Long
Private Sub Form_Load()
ShowCursor False 'hide cursor
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
ShowCursor True 'show cursor
End Sub
http://www.vbforums.com/showthread.php?t=235194
Keith
I've been programming with VB for 25 years. Started with VB4 16bit Pro, VB5 Pro, VB6 Pro/Enterprise and now VB3 Pro. But I'm no expert, I'm still learning.
-
Mar 9th, 2011, 09:27 AM
#3
Re: How to hide mouse cursor (VB6)
And to piggyback on Keith's reply. Calls to ShowCursor accumulate. If you call it 10x with False, gotta call it 10x with true for example. The return value of the API will let you know the accumulative value and ideally, you want 0 as the return value when the cursor is to be shown
-
Mar 10th, 2011, 02:51 PM
#4
Thread Starter
Hyperactive Member
Re: [RESOLVED] How to hide mouse cursor (VB6)
Thanks guys !!
I used Keithuk's code and Lavolpe's comments were important also to understand its mechanics.
Now I have my own screensaver, a digital clock . Just 24 KB !
-
Mar 10th, 2011, 03:11 PM
#5
Junior Member
Re: [RESOLVED] How to hide mouse cursor (VB6)
Horazio,
Could you kindly share your code please? I too would like to make my own screensaver but don't know where to start!
-
Mar 11th, 2011, 12:23 PM
#6
Thread Starter
Hyperactive Member
Re: [RESOLVED] How to hide mouse cursor (VB6)
Trust me, it's so simple you dont even need to look at the code.
Just remember:
1) a screensaver is just an ordinary executable with SCR extension instead of EXE (u compile it normally and then u change its extension to SCR)
2) windows maximized, on top, form with no borders
3) it must self shut down when you click the mouse or press a key
4) Add whatever u like ;-)
Rock on
-
Mar 12th, 2011, 12:27 AM
#7
Junior Member
Re: [RESOLVED] How to hide mouse cursor (VB6)
Thanks, buddy, that helped a lot.
-
Mar 13th, 2011, 04:24 AM
#8
Junior Member
Re: [RESOLVED] How to hide mouse cursor (VB6)
Sorry to return to this, but I have one minor problem, though: how to include the interface with the user to set preferences and other settings? If there is another form, how do you decide when to launch which?
-
Mar 13th, 2011, 10:49 AM
#9
Re: [RESOLVED] How to hide mouse cursor (VB6)
Yes you can have an Options Form where you can set various settings for the app and save them to an ini file or the dirty registry.
Keith
I've been programming with VB for 25 years. Started with VB4 16bit Pro, VB5 Pro, VB6 Pro/Enterprise and now VB3 Pro. But I'm no expert, I'm still learning.
-
Mar 13th, 2011, 02:16 PM
#10
Junior Member
Re: [RESOLVED] How to hide mouse cursor (VB6)
I guessed as much, but my question was: if the app will launch with the screensaver form and exit from there, how does a user ever get to the Options form?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|