Home > Back-end >  Consult everybody a great god OnIdle function overloading problem
Consult everybody a great god OnIdle function overloading problem

Time:09-22

In the MFC source code: int CWinThread: : Run ()
{
ASSERT_VALID (this);

//for tracking the idle time state
BOOL bIdle=TRUE;
LONG lIdleCount=0;

//acquire and dispatch messages until a WM_QUIT message is received.
For (;; )
{
//phase1: check to see if we can do the idle work
While (bIdle & amp; & ! : : PeekMessage (& amp; M_msgCur, NULL, NULL, NULL, PM_NOREMOVE))
{
//call OnIdle while in bIdle state
if (! OnIdle (lIdleCount++))
BIdle=FALSE;//assume no "idle" state
}

//phase2: pump messages while the available
Do
{
//pump message, but quit on WM_QUIT
if (! PumpMessage ())
Return ExitInstance ();

//reset "no idle state after pumping" normal "message
If (IsIdleMessage (& amp; M_msgCur))
{
BIdle=TRUE;
LIdleCount=0;
}

} while (: : PeekMessage (& amp; M_msgCur, NULL, NULL, NULL, PM_NOREMOVE));
}
ASSERT (FALSE);//not reachable
}
If I in CWinApp derived class reloading the OnIdle function, virtual BOOL OnIdle (LONG lCount), so if the code above is my overloaded after OnIdle function call
  • Related