Article ID: 200054 - Last Review: November 21, 2006 - Revision: 2.1 PRB: OnTimer() Is Not Called Repeatedly for a List ControlThis article was previously published under Q200054 SYMPTOMS
If you call the SetTimer function to send periodic WM_TIMER messages to a list control, you may find that the WM_TIMER message handler (the OnTimer function) for a list control is called only twice.
CAUSE
The WM_TIMER handler in the list control calls the KillTimer function.
RESOLUTION
If you define the timer ID in the SetTimer call, do not call the default handler for WM_TIMER.
STATUS
This behavior is by design.
MORE INFORMATION
The list control uses the timer for editing labels, and for scrolling. When you handle the timer message, if the timer ID is your own timer, don't call the default handler (CListCtrl::OnTimer). In the sample code below, without the if clause in the CMyListCtrl::OnTimer function, the default WM_TIMER handler is always called, which destroys both the control's timer and your own timer. As a result, you should see a trace statement for each timer. APPLIES TO
| Article Translations
|

Back to the top
