Export (0) Print
Expand All

CWinThread::OnIdle 

Override this member function to perform idle-time processing.


virtual BOOL OnIdle(
   LONG lCount 
);

Parameters

lCount

A counter incremented each time OnIdle is called when the thread's message queue is empty. This count is reset to 0 each time a new message is processed. You can use the lCount parameter to determine the relative length of time the thread has been idle without processing a message.

Nonzero to receive more idle processing time; 0 if no more idle processing time is needed.

OnIdle is called in the default message loop when the thread's message queue is empty. Use your override to call your own background idle-handler tasks.

OnIdle should return 0 to indicate that no additional idle processing time is required. The lCount parameter is incremented each time OnIdle is called when the message queue is empty and is reset to 0 each time a new message is processed. You can call your different idle routines based on this count.

The default implementation of this member function frees temporary objects and unused dynamic link libraries from memory.

This member function is used only in user-interface threads.

Because the application cannot process messages until OnIdle returns, do not perform lengthy tasks in this function.

Community Additions

ADD
Show:
© 2014 Microsoft