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

ScreenSaver Manager - An example of using the SystemTray class in WTL

0.00/5 (No votes)
6 Jul 2006 1  
Managing screensaver activity from the Taskbar.

Sample Image - ssman.gif

Introduction

Sometimes I need a tool that could stop running the screensaver (for example, when I'm waiting for an important email message). I've looked over CodeProject and found some nice solutions. I gathered them together and spent 3 or 4 hours to write this small tool.

Features

  • Enable/disable screensaver from the taskbar
  • Restore original state of screensaver on exit
  • Restore icon in taskbar after Explorer crashes
  • Easy access to Control Panel -> Desktop Settings

Implementation

At the base of this project is Chris Maunder's System Tray class and the Win32 API SystemParametersInfo function.

To start with, I created a WTL Dialog-Based Project and then removed MainDialog, and added a main window class inherited from the CWindowImpl class. To implement check boxes in the popup menu that shows when the user right-clicks in the taskbar icon, I needed to inherit my own class from CSystemTray. Its virtual function CustomizeMenu was rewritten. Then, I added some SystemParametersInfo calls, including CLimitSingleInstance from Microsoft. Some modifications were made in CSystemTray.

Acknowledgments

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