Write your own screen saver:
This example teaches you how to write a simple screen saver for windows. The screen saver will turn the screen black and balloons will apear and fly to the top.

This is a large example programm. You can download the source code here:
Screen saver source code (16 bit for VB 3.0)
Screen saver source code (32 bit for VB 5.0)

You need two forms and a global module for the screen saver

The first thing you need is a module with a sub_main procedure:
We need some code that checks, if the screen saver is already running. We need also some code to switch of the mouse cursor. To do so we need a little help from the Windows API:

---code begins here---
Declare Function getmoduleusage Lib "kernel.dll" (ByVal Handle%) As Integer
Declare Function gettaskds Lib "kernel.dll" () As Integer
Declare Sub showcursor Lib "user.dll" (ByVal bshow%)
---code ends here---

The finished sub_main procedure looks like this:

---code begins here---
Rem check of already running
If getmoduleusage(gettaskds()) > 1 Then End
Rem check command string and show configuration dialog
rem if needed
If InStr(Command$, "s") Or InStr(Command$, "S") Then Form1.Show
If InStr(Command$, "c") Or InStr(Command$, "C") Then Form2.Show
---code ends here---

Now open the first form. We need to switch the mouse cursor of, when the screen- saver is started, and back on when the user returns to windows.
Add the line " showcursor FALSE " to the form_load procedure,
and add the line " showcursor TRUE " to the form_unload procedure

Thatīs basicly it! Now add some picture boxes and moves them in your form, and oh I almost forgot, add the following code to the mouse_move procedure, so that we can quit the screen saver:

---code begins here---
Static mouse As Integer
mouse = mouse + 1
If mouse = 8 Then Unload form1
---code ends here---

The last thing:
When you make an exe-file, change the filename to .SCR instead of .EXE and Change the application title to "SCRNSAVE:(NAME)"
Then place the .SCR file in your windows directory and you are done!

Go back to my vb-page