Contents:

Main
Tutorials
3D Control
'97 Tool Bar
Screen Saver
NotePad
y2k counter

Examples
Source Code
FAQ
Files

Microsoft

 

Make your own Screen Saver

This is alot easier than people think. Screen savers are simply .exe files renamed to .scr. There are only a few things you need to do.

The Project should consist of a Blank form, a Set-up form and a module.

Make the project start up from Sub Main. Do this by going to Tools | Options | Project and selecting the Start-up form as Sub Main.

This Sub should look something like this:

Sub main()

' Check to see if we should blank the screen, or display
' the Setup dialog box.


If
InStr(Command$, "/c") Then ' looks in command string for screen saver parameters
SetupForm.Show 1
ElseIf
InStr(Command$, "/s") Then
BlankForm.Show
End If

' Wait until there are no form visible, then quit.
While
DoEvents() > 0 ' Loop until no forms visible
Wend
End Sub

This is all you really need but this won't look very good. On the setup form you can put all your parameters and save them to an INI or the system registry.
You can add routines to the blank form so that the screen saver actually does something; like animations, flashing colours, dots and lines etc. etc.
But there are some more important things, the Mouse Pointer still shows. So, we'll use an API to get rid of it. Put this in the declarations section of the module:

Declare Function ShowCursor Lib "USER32" (ByVal fShow As Integer) As Integer

Then add these subs:

Sub HideMouse()
While
ShowCursor(False) >= 0
Wend
End Sub

Sub ShowMouse()
While
ShowCursor(True) < 0
Wend
End Sub

Call the HideMouse() from the Blankform's Load event and the ShowMouse() from the UnLoad.

You can download an example screen saver here.

Down Load Screen Saver