by Mark Dawson - Independent Developer
Writing your own Control Panel Desktop activated screen saver requires only a few simple steps. Some other methods I've seen go to great lengths by writing activation routines in C that register themselves with ScreenSaverProc and WinExec a VB exe, or use custom DLLs. However, you can do everything from within VB much more simply.
Windows only scans its home directory when firing up screen savers.
Make a VB project with at least a single maximised background form. This form should have all Control Boxes, Max/Min buttons turned off. Set BorderStyle to 0-None.
I like to make the background totally black by setting the BackColor to black.
In the formís KeyDown and MouseMove events, insert code to end the app if the event is detected. One quirk is that, for some reason, VB apps detect one MouseMove event the first time the form is shown. To get around this, insert code to discard the first (and ONLY the first) MouseMove event.
In your Form_Load, Sub Main or whatever, insert code to parse the command line for the argument "/C". Windows Control Panel Desktop sends this command line argument to your screen saver when you click on Setup.
You could put in a nice configuration dialog for your screen saver. Along with an About box claiming credit for your wonderful saver.
For that professional look, you really should also get rid of the unsightly mouse pointer using the ShowCursor API. Don't forget to re-enable it on screen saver de-activation otherwise users will lose their mouse!
You should also further beautify your screen saver by calling the SetWindowPos API (yeah I know, another API call) to make your saverís background form "TopMost" ie. it always remains on top, thereby covering running CLOCK.EXEs and the like.
You now have the skeleton of a screen saver. You can now animate cows chewing their cud in 16.7 million colours, playback DOOM deathmatches, or display compromising scanned bitmaps of your boss and all your workmates.