function call when event loop is idle?

Hello all,

Does anyone know of a simple way to destinate a function (implemented 
by the client application) to be called when the event loop is idle? 
For example, the client might want to do some housekeeping tasks 
and/or fetch some documents from the net (not initiated by the user 
or the result of previous fetches) when the event loop has no 
outstanding user event or active socket.

In case it does matter, I work on Windows NT platform.

Thanks in advance for any information.

Paul Law