u can use timer for that.
in the startup, set a timer using
SetTimer( 2, 100, NULL);
where 2 is the id for timer, then for every 100 millisecond, handler funtion will be called.
then, go 2 class wizard and add messagehandler
function OnTimer(idEvent ) will be added 2 the function. write the code as u want. u can change time as u want instead of 100 ms.