Click here to Skip to main content
Click here to Skip to main content
Go to top

Clock Screen Saver

, 27 Jun 2004
Rate this:
Please Sign up or sign in to vote.
A mouse trailing clock screen saver written in MFC.

Introduction

This project is a screen saver application that I originally started as a way to pick up C++/MFC. That was a few years back, and in that time I’ve gone back to it a number of times to add new features and try new things. It’s made the rounds of my family’s and friend’s computers and, since they all seem to like it, I thought I’d put it out here on CodeProject in the hopes that you all may enjoy it as well.

Background

Back in 2001, after the Internet bubble burst, the two man consulting company I was part of found itself suddenly without clients or cash. So it was back to working for the man for the both of us. My former business partner found a job before I did and was kind enough to brow-beat his new boss into giving me an interview as well.

At the time I had done mostly VB6 programming, and during the interview it became quickly apparent that they were looking for an MFC developer. I had done some C++ programming and did as well as I could under the circumstances but came home certain that I wouldn’t get the job.

Well, as they say, necessity is the mother of invention. That, plus a quickly dwindling bank account and plenty of free time makes for a great motivator, so I thought I’d better do something quick to prove that I was the person for the job.

At this same time, my dad sent me a cool web page that used some pretty impressive JavaScript in order to create an animated clock that tracked the user’s mouse as it moved around the page. He wanted to know if there was any way to turn it into a screen saver.

I decided to implement the same thing in MFC, and send it off to the guys who had interviewed me in the hopes of changing their minds.

After a week of nearly round the clock (pun intended) study and development, I had it working to the point that I figured it was ready to go. Literally, as I was writing the email to the head of the department where I had been interviewed, explaining the application and my motivation for writing it, he called me on the phone. A change of direction on the project, and some additional prodding from my associate lead them to hire me!

So I never did send him this application, but my dad enjoyed it and I learned a lot in that short time.

In the years since, I’ve added some features to it like Outlook Calendar and MAPI support for signaling when new mail has arrived while the screen saver is active. So now, it’s actually a nice little program, and kind of a fun screen saver to boot.

Using the code

Because the Outlook integration requires some MS Office type libraries, and I’m sure it’s not legal to redistribute those, I have conditional compilation statements around those parts. If you do want to compile the Outlook integration code, you’ll need a copy of MSOUTL.OLB and MSO9.DLL. Define MS_OFFICE_INTEGRATION in stdafx.h, make sure the two Office typelibs are in the right place, and it should compile.

The version installed by the downloadable MSI (above) includes the Outlook integration functionality.

The MAPI mail notification should work with any MAPI compliant email client, but I’ve only tested it with Outlook Express, so your mileage may vary.

Once you install ClockSaver.scr, it will show up in your list of available screen savers as ClockSaver.

Some Acknowledgements

I don’t know to whom to attribute the original JavaScript clock as the HTML page that I got from my dad did not have any information about the author.

The screen saver base class came from an article by chensu, posted on CodeGuru.com. (Give me break, I hadn’t heard about CodeProject yet).

Points of Interest

One of the most interesting things about working on this project over such a long period, is that a lot of the code comes from CodeProject, which I think is a testament to how valuable a resource this site is!

This project uses:

The code to support multiple monitors I eventually turned into some reusable classes, so it also uses MFC Classes for Multiple Monitors.

History

  • Initial release 1.1.3 - 5/30/2004
  • 1.1.4 - 6/14/2004
    • Added separate color settings for second hand and date
    • Spruced up the config dialog
    • Added shutdown computer option
    • Bugs fixes, refactoring and extensive code clean-up
  • 1.1.5 - 6/24/2004
    • Fixed bug with AnimateWindow
    • Improved MAPI support
    • Added "force left to right" option
    • Added custom text option
    • Added NT4 support

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Don Kackman
Team Leader Starkey Laboratories
United States United States
The first computer program I ever wrote was in BASIC on a TRS-80 Model I and it looked something like:
10 PRINT "Don is cool"
20 GOTO 10
It only went downhill from there.
 
Hey look, I've got a blog

Comments and Discussions

 
GeneralBUG: the screen saver name Pinmembershineway16-Jul-05 3:14 
AnswerRe: BUG: the screen saver name PinmemberJinoh7-Apr-12 4:04 

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

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

| Advertise | Privacy | Mobile
Web01 | 2.8.140916.1 | Last Updated 28 Jun 2004
Article Copyright 2004 by Don Kackman
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid