Click here to Skip to main content
15,894,740 members
Articles / Programming Languages / C++

Clock Screen Saver

Rate me:
Please Sign up or sign in to vote.
4.73/5 (42 votes)
27 Jun 2004CPOL4 min read 155K   4.5K   48  
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.
#pragma once
#include "saver.h"

// CClockSettings command target

class CClockSettings : public CObject
{
public:
	CClockSettings();
	CClockSettings( const CClockSettings& other );
	virtual ~CClockSettings();
	

//implementation
public:
	CClockSettings& operator =( const CClockSettings& op1 );

	void Save() const;
	void Load();

	CFont* GetFont() const;
	void SetFont( CFont* const pFont );

	double GetDiameter() const;

	COLORREF GetFaceColor() const;
	void SetFaceColor( const COLORREF color );

	COLORREF GetDateColor() const;
	void SetDateColor(const COLORREF color);

	COLORREF GetSecondHandColor() const;
	void SetSecondHandColor(const COLORREF color);

	double GetTrackingSpeed() const;
	void SetTrackingSpeed(const double speed);

	double GetRotationSpeed() const;
	void SetRotationSpeed(const double speed);

	CLOCKFACE GetClockFace() const;
	void SetClockFace(const CLOCKFACE face);

	BOOL GetExitOnMouse() const;
	void SetExitOnMouse( const BOOL value );

	BOOL GetShowNewMailNotification() const;
	void SetShowNewMailNotification( const BOOL value );

	int GetMouseTimeOutInterval() const;
	void SetMouseTimeOutInterval( const int value );

	BOOL GetShutDownComputer() const;
	void SetShutDownComputer( const BOOL value );

	int GetShutDownComputerInterval() const;
	void SetShutDownComputerInterval( const int value );

	BOOL GetForceLeftToRight() const;
	void SetForceLeftToRight( const BOOL value );

	BOOL GetUseCustomText() const;
	void SetUseCustomText( const BOOL value );

	LPCTSTR GetCustomText() const;
	void SetCustomText( const LPCTSTR value );

protected:
	void ResetFont(LOGFONT* plf);

	COLORREF m_FaceColor;
	COLORREF m_DateColor;
	COLORREF m_SecondHandColor;

	CLOCKFACE m_cfFace;
	double m_rTrackingSpeed;
	double m_rRotationSpeed;

	CFont*  m_pFont;

	BOOL m_ExitOnMouse;
	BOOL m_ShowNewMailNotification;
	BOOL m_ShutDownComputer;
	BOOL m_ForceLeftToRight;
	BOOL m_UseCustomText;

	CString m_CustomText;

	int m_MouseTimeOutInterval;		// minutes
	int m_ShutDownComputerInterval;	// hours
};


By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

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


Written By
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