CWaitableTimer
v1.05
Welcome to CWaitableTimer, a simple C++ class to support access to the Window
APIs dealing with waitable timers.
Features
- Simple and clean C++ interface.
- The code is Unicode enabled and build configurations are provided.
Usage
- Add wtimer.h to your project.
- Just declare an instance of CWaitableTimer and call its methods as needed.
For further information on waitable timers, please consult the Windows SDK.
- To see the code in action, have a look at the code in the sample app in
the function "OnTest1" in the module "waittestdlg.cpp".
- As of v1.03, the code is now for Visual C++ 2005 or later.
Copyright
- You are allowed to include the source code in any product (commercial, shareware,
freeware or otherwise) when your product is released in binary form.
- You are allowed to modify the source code in any way you want except you
cannot modify the copyright details at the top of each module.
- If you want to distribute source code with your application, then you are
only allowed to distribute versions released by the author. This is to maintain
a single distribution point for the source code.
History
v1.0 (8 August 2000)
8 November 2002
- Removed some unnecessary comments in the module
- Updated copyright details in the module
v1.01 (18 February 2004)
- Completion routine can now be passed an LPVOID parameter just like the SDK
equivalent. Thanks to Erenst F. Wepener for suggesting this addition.
- Minor updates to the code to allow the code to compile on VC 5 without the
requirement for the Platform SDK to be installed.
v1.02 (26 June 2006)
- Updated the documentation to use the same style as the web site.
- Updated copyright details.
- Removed various defines in code which were taken from the Platform SDK.
This does mean that the code now requires the Platform SDK if compiled using
VC 6.
- Optimized CWaitableTimer constructor code.
- Combined the functionality of the _WAITABLE_TIMER_DATA class into the main
CWaitableTimer class.
- Code now uses new C++ style casts rather than old style C casts where necessary.
- Reviewed all TRACE statements for correctness
v1.03 (1 June 2008)
- Code now compiles cleanly using Code Analysis (/analyze)
- The code has now been updated to support VC 2005 or later only.
- Updated the sample app to clean compile on VC 2008
v1.04 (16 February 2014)
- Updated copyright details
- Made the class into a Header only implementation. The WTimer.cpp module
is now defunct.
- Code now no longer uses GetProcAddress to obtain the waitable timer functions
since waitable timers have been available since Windows 2000.
- Made the code independent of MFC.
- Updated the code to clean compile using /analyze
- Updated the code to clean compile on VC 2010, 2012 & 2013
v1.05 (4 December 2015)
- Updated copyright details.
- Updated the code to clean compile on VC 2015.
- All the class methods have had SAL annotations added
- The SetOnceOffAbsolute, SetOnceOffRelative, SetPeriodicAbsolute &
SetPeriodicRelative methods has been reworked to expose all the parameters
of the underlying SetWaitableTimer API.
- Removed unnecessary ATLTRACE calls from various methods
- Added support for CreateWaitableTimerEx and SetWaitableTimerEx
APIs to class
Contacting the Author
PJ Naughter
Email: pjna@naughter.com
Web: http://www.naughter.com
4 December 2014