This page was created by Mike Beckman, you can e-mail him at mbeckman@itis.com.
Table of Contents:
Have you ever wanted to make your own screen saver program? I'm
sure that it has crossed every Windows developer's mind at some
point. But man, it's so complicated, right? I mean, I have to
get my own special program to make those *.SCR files, right? Nope.
The truth is, it is not complicated, and those *.SCR files are
really just *.EXE files, which, of course, VB has no trouble making!
Now let's get started with our tutorial on screen savers, shall
we?
The basic screen saver is a form taking up the whole screen, some
graphics that move here and there on the screen, and the ability
to end the program when the user hits a key or moves the mouse.
You will probably want to hide the mouse cursor, add a password
dialog box, and create a little configuration form, but this will
be discussed later. When you compile the EXE file, you need to
tell Visual Basic that this is a screen saver. Choose Make EXE
File from the File menu. In the filename dialog box, change the
file extension from EXE to SCR. Next, click on the Options button
to bring up the EXE Options dialog box. In the Title field, type
"SCRNSAVE" in front of the application title, without
the quotes. Be sure to place the SCR file in the Windows directory
so that Windows can find it!
So that's how you compile the screen saver. But how do you get
started in making one? The file SCRNTUT1.SCR is a demo screen
saver that I made. It is a fully functional screen saver, however
there is a lot that can be added to it. Feel free to do whatever
you want with it. All that I ask is that you e-mail me a copy
so that I can see what you did. To get started on the screen saver,
I set the form's BorderStyle property to 0 - None, the
BackColor property to &H00000000& (black) and the
WindowState property to 2 - Maximized. Please download
the example program to run the example program and view the sample
source in its entirety.
The different parameters that can be passed through the Command$ variable by Windows95 are as follows (SCRNTUT1.SCR is designed for Windows 3.1, but it will still run in Windows95. The Windows 3.1 Control Panel only passes the /C and /S parameters (I think!)):
Click here to download the sample
screen saver, SCRNTUT1.ZIP (approx. 8k).
Conclusion
There are many other things that can be done to a screen saver.
This screen saver doesn't even do anything! You could add a timer
so that every 10 seconds a randomly colored line is drawn in a
random place on the screen. You could add the abilities for it
to request a password when the user moves the mouse. You could
I
think I'll leave that up to you!
Stay tuned, there will be a second screensaver downloadable project comming soon. Please come back often!
