I was doing some work on an example that needed a timer and so I took some time to create a CTimer class. Unlike the StartTimer method that's part of the base Window class, the CTimer class doesn't use a window and doesn't require that you implement your own callback function used by the SetTimer API call.
CTimer is designed to work in a much more object oriented fashion, in that to create a timer you define your own class derived from CTimer and implement the OnTimer method. The code is fairly well documentated and I included a simple example which demonstrates how to use it.
Nice.
Just a note...the StartTimer method of the window class doesn't require a callback funciton. It is optional. If you don't supply one then Windows will send WM_TIMER messages to your window which can be handled by the OnTimer override.
Paul.
Thanks. And true, that really should have been an "and/or" there. You either provide a callback function, or you have to process messages if you use a window handle with SetTimer. CTimer just makes things a little easier because you don't have to worry about the underlying mechanism, you just create an instance of the class and off you go. :)
I've updated the class and example for the latest version of the compiler (the 2/16/2006 build).