Article ID: 146907 - Last Review: June 29, 2004 - Revision: 3.2 How To Create a Screen Saver in Visual BasicThis article was previously published under Q146907 On This PageSUMMARY
You can create a Windows screen saver with Visual Basic by following the
guidelines listed below. However, please note that this article gives only
a very rough outline of what you should do for a robust screen saver. These
are general guidelines only.
MORE INFORMATION
Follow these guidelines when creating a Windows screen saver with Visual
Basic:
Preventing Multiple LaunchesWindows usually launches the screen saver program multiple times. To prevent more than one copy of your screen saver from running, add the following statements to the Form_Load event handler, or Sub Main if used:Launching the Screen SaverWindows takes care of launching the Screen Saver. It keeps track of system idle time and launches the screen saver program. You can use a timer control to periodically draw graphics on the form.Screen savers are selected and configured from Windows Control Panel in the Desktop dialog. The screen saver section of this dialog has a button labeled Setup that invokes the screen saver program with the command line option /c. When your program is invoked with this option, you can display a configuration form to allow the user to select settings such as speed, number of objects, colors, and so on. Detect the /c command line parameter by checking the Command$ function. For example: Possible ImprovementsYou may also want your program to appear on top of all other windows by making it a TOPMOST window.For additional information, please see the following article(s) in the Microsoft Knowledge Base: 84251
(http://support.microsoft.com/kb/84251/EN-US/
)
How to Create a Topmost or Floating Window in Visual Basic
Also, you can find two example programs and a complete explanation showing
how to write your own screen savers in Visual Basic in the following book:
"Visual Basic Workshop 3.0" by John C. Craig, published by Microsoft
Press.
This article is a rough outline of what you should do for a robust screen
saver. For example, you might want to have the startup be a Sub Main() in
which you check for a previous instance and End if there is one. This would
avoid the form load totally if there were already an instance running. It
might also avoid the artifact MouseMove problem.
| Article Translations
|
Back to the top
