MSND上说在OnIdel()内返回0,则不再调用
可是我的程序还是在调用.怎么回事?

解决方案 »

  1.   

    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 idle work
      while (bIdle &&
       !::PeekMessage(&m_msgCur, NULL, NULL, NULL, PM_NOREMOVE))
      {
       // call OnIdle while in bIdle state
       if (!OnIdle(lIdleCount++))     //这里调用OnIdle虚函数
        bIdle = FALSE; // assume "no idle" state
      }  // phase2: pump messages while available
      do
      {
       // pump message, but quit on WM_QUIT
       if (!PumpMessage())
        return ExitInstance();   // reset "no idle" state after pumping "normal" message
       if (IsIdleMessage(&m_msgCur))
       {
        bIdle = TRUE;
        lIdleCount = 0;
       }  } while (::PeekMessage(&m_msgCur, NULL, NULL, NULL, PM_NOREMOVE));
     }    //无限循环,退出条件是收到WM_QUIT消息。 ASSERT(FALSE);  // not reachable
    }
      

  2.   

    http://www.moon-soft.com/doc/19154.htm