Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

Clock Screen Saver

0.00/5 (No votes)
27 Jun 2004 2  
A mouse trailing clock screen saver written in MFC
This project is a screen saver application that I originally started as a way to pick up C++/MFC. In the years since, I’ve added some features to it like Outlook Calendar and MAPI support for signaling when new mail arrives while the screen saver is active.

Image 1

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 a 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

  • 30th May, 2004: Initial release 1.1.3
  • 14th June, 2004: 1.1.4
    • 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
  • 24th June, 2004: 1.1.5
    • Fixed bug with AnimateWindow
    • Improved MAPI support
    • Added "force left to right" option
    • Added custom text option
    • Added NT4 support

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