c++ - CListCtrl class override and OnTimer -
i'm not sure if i'm doing undocumented. created own class derived clistctrl , overrode ontimer handler in it:
void clistctrl2::ontimer(uint_ptr nidevent) { // todo: add message handler code here and/or call default switch(nidevent) { case my_timer_id: { //do processing domyprocessing(); } break; default: { //default clistctrl::ontimer(nidevent); } break; } }
but seems strange me ontimer() routine called timer ids not mine. instance, quick debugger checkpoint research turns out default
handler called nidevent
set 45
, 43
.
are there timer ids reserved should avoid using myself?
from clistctrl
documentation see text:
also see:
- knowledge base article q200054: prb: ontimer() not called repeatedly list control
and article, pertinent excerpts:
if call settimer function send periodic wm_timer messages list control, may find wm_timer message handler (the ontimer function) list control called twice.
....
the list control uses timer editing labels, , scrolling. when handle timer message, if timer id own timer, don't call default handler (clistctrl::ontimer).
so, confirms observe. list control uses timer. can find no documentation specific ids used. guess microsoft not wish commit documenting specific ids used. regard control's implementation private , wish retain option of using more timer ids in future versions. iinspectable points out, have done reserving range of ids.
my recommendation regard list control's timer out of bounds, , reserved use control. derived class, use different timer. create message window , use receive timer events. can subclass cwnd
achieve this.
Comments
Post a Comment