Click here to Skip to main content
15,867,594 members
Articles / Programming Languages / C#
Article

Andrew's CodeProject Screen Saver

Rate me:
Please Sign up or sign in to vote.
5.00/5 (10 votes)
20 May 20023 min read 214.5K   470   43   37
(Yet) another screen saver for the Code Project competition, with code in C# and (coming soon) some details about how certain aspects of the code involved work.

Introduction

Options panel

Yes folks, my secret is out! I've been developing a screen saver for the competition. "Huh?" I hear you all say. Well, I've been really busy of late, so didn't want to make a big fuss about it and then not deliver. Luckily, after several weeks of my C# screen saver sounding more like an F natural (groan), I managed to kick the little baby into touch in time to catch the voting form being put up.

Before I go any further, may I just give a big thanks to Chris, firstly for grabbing onto such a great idea for a CP competition, and secondly for building the final .exe on his machine to save me from those Beta 2 blues (oh, they just keep coming!).

Here's a rundown of the main features of the screensaver:

  • Downloads data in a separate thread so as not to block user interface
  • Detects if a user is offline
  • Will retry after five minutes should the connection to the server fail
  • Hair raising graphics
  • Customisable animation speed for users with slower machines etc.

Installation

Installation is as easy as pie:

  1. Copy CP Screensaver.scr into your Windows system folder.
  2. Copy the Images folder as a sub-folder of your Windows system folder.
  3. Select the CP Screensaver from your Display properties.

Done like a dinner!

How it works

Check back soon! Major areas to be covered will be:

  • Double buffering
  • Alpha blending (the fade effect)
  • State management
  • Multiple monitor support (presuming it actually works as I intended, see below).

Multiple Monitors

Unfortunately, I don't run a multi-monitor system, which means that, whilst I have added support for multiple monitors (not particularly efficient support, granted), I have been unable to test the saver on such a configuration. If you have been able to try the saver out with multiple monitors, I'd be interested to hear your successes/failures in the comments section at the bottom of the article.

To do

The screensaver certainly has some way to go in the future but I simply don't have time to do anything with it just yet; here is a list of stuff I plan to do, off the top of my head:

  • Subtly animated background with alpha blending on lights of lift platform
  • Caching of local data so if the user isn't connected they can still see a list of posts etc. from the last time the saver managed to connect.
  • Better handling of really high and really low resolutions (maybe utilise extra space somehow?)
  • Better multiple monitor support
  • Some bits of optimisations (there are a few loop invariants that need sorting out, but nothing that's too big of a problem)

Conclusion

Okay - so I hope you enjoy what is already here. The code isn't in the neatest of forms by any means because I used this project as a learn-C#-as-you go, so there may be the odd rough edge here and there, though on the whole it's pretty reasonable.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
United Kingdom United Kingdom
Andrew is currently a student at the University of Cambridge, working towards a degree in Computer Science. The word 'working' is used here in a vague sense, with the hope that the reader will realise that the same sentence contained the word 'student'.

Aside from computing he has a strong interest in music, and enjoys the outdoors, particularly when the weather permits going out in them... To Andrew, cycling is fun, sailing is more fun, and the odd camping trip and walk is certainly what the doctor ordered.

In terms of programming experience, he first started writing programs for the Commodore Amiga using BASIC, after which he learned the joys of C and has never looked back. Since, he has added C++ and C# to his repotoire, along with a bunch of other crazy languages like ML that they like to teach in college.

Comments and Discussions

 
GeneralYour codes are very useful Pin
Nicholas Wang22-Oct-06 21:50
Nicholas Wang22-Oct-06 21:50 
GeneralOptions panel screenshot in Firefox [modified] Pin
unRheal22-Jun-06 13:42
unRheal22-Jun-06 13:42 
GeneralDefult Browser Pin
snoopybb23-Nov-05 11:27
snoopybb23-Nov-05 11:27 
GeneralMultiple Monitors - Here's how Pin
NetDave23-Jul-04 14:22
NetDave23-Jul-04 14:22 
GeneralRe: Multiple Monitors - Here's how Pin
kholland1525-Oct-04 11:26
kholland1525-Oct-04 11:26 
GeneralRe: Multiple Monitors - Here's how Pin
NetDave25-Oct-04 14:23
NetDave25-Oct-04 14:23 
GeneralRe: Multiple Monitors - Here's how Pin
Rei Miyasaka28-Nov-04 14:45
Rei Miyasaka28-Nov-04 14:45 
GeneralFunction Keys don't open the browser Pin
flipdoubt7-Aug-03 7:18
flipdoubt7-Aug-03 7:18 
QuestionRe: Function Keys don't open the browser Pin
snoopybb23-Nov-05 11:22
snoopybb23-Nov-05 11:22 
QuestionHow to create SCR file Pin
vishalarora0328-Mar-03 7:36
vishalarora0328-Mar-03 7:36 
AnswerRe: How to create SCR file Pin
Andrew Peace28-Mar-03 7:54
Andrew Peace28-Mar-03 7:54 
GeneralRe: How to create SCR file Pin
vishalarora0328-Mar-03 8:15
vishalarora0328-Mar-03 8:15 
GeneralRe: How to create SCR file Pin
MichaelCoder28-Jun-04 12:18
MichaelCoder28-Jun-04 12:18 
GeneralMulti Monitor Pin
tplunk25-Nov-02 16:52
tplunk25-Nov-02 16:52 
GeneralCan't Download Demo Zip Pin
Steve McLenithan23-Nov-02 16:43
Steve McLenithan23-Nov-02 16:43 
GeneralRe: Can't Download Demo Zip Pin
ShiXiangYang9-Mar-09 4:08
ShiXiangYang9-Mar-09 4:08 
GeneralRe: Can't Download Demo Zip Pin
Steve McLenithan11-Mar-09 5:27
Steve McLenithan11-Mar-09 5:27 
GeneralTest from 2 monitor system Pin
doublej26-Aug-02 4:01
doublej26-Aug-02 4:01 
GeneralRe: Test from 2 monitor system Pin
NetDave23-Jul-04 11:54
NetDave23-Jul-04 11:54 
As Andrew said, he didn't have dual monitors to test it on. The problem is that he's looping through the screens one at a time and launching the screensaver form synchronously on each screen. When you move the mouse, the saver on the first screen exits, then the for loop starts the saver on the second screen.

The proper way to do this is to have the screen form handle the multiple screens, rather than Main. In the unmanaged world, this was easy because you can simply (well, sort of) draw to the entire virtual desktop as one big screen.

I like the idea of a multimonitor screensaver and may take a crack at writing a template for one that works. But still, great job Andrew!

QRZ? de WAØTTN
GeneralUpdated Pin
Andrew Peace22-May-02 11:47
Andrew Peace22-May-02 11:47 
GeneralUnable to Connect to Server Pin
Alvaro Mendez21-May-02 6:58
Alvaro Mendez21-May-02 6:58 
GeneralRe: Unable to Connect to Server Pin
Andrew Peace21-May-02 11:52
Andrew Peace21-May-02 11:52 
GeneralUnable to Connect to Server too Pin
silas_yao13-Jun-06 21:44
silas_yao13-Jun-06 21:44 
GeneralOne Suggestion Pin
Rob Edwards21-May-02 2:45
Rob Edwards21-May-02 2:45 
QuestionNot working... on my system... No C#? Pin
Boris Sundic20-May-02 16:11
Boris Sundic20-May-02 16:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.