void FUCTION()
{
MSG msg;
for (int i = 0; i < 10; i ++)

while (::PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE))
AfxGetApp()->PumpMessage();
for (LONG lIdle = 0; AfxGetApp()->OnIdle(lIdle); lIdle ++);
}
}

解决方案 »

  1.   

    把时间片的控制权交还给系统.相当于vb中的DoEvents函数的功能。
      

  2.   

    The PeekMessage function dispatches incoming sent messages, checks the thread message queue for a posted message, and retrieves the message (if any exist). BOOL PeekMessage(
      LPMSG lpMsg,         // message information
      HWND hWnd,           // handle to window
      UINT wMsgFilterMin,  // first message
      UINT wMsgFilterMax,  // last message
      UINT wRemoveMsg      // removal options
    );
    PumpMessage???    //此句为哪位自己生产的吧?Nonzero to receive more idle processing time; 0 if no more idle processing time is needed.ParameterslCountA 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.我查MSDN的~呵呵
      

  3.   

    从消息队列里取得消息。
    自己分发和translate.
      

  4.   

    while (::PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE))
    PM_NOREMOVE  改成PM_REMOVE.
      

  5.   

    可以参考http://www.csdn.net/develop/read_article.asp?id=13493这段代码处理windows消息,"for (int i = 0; i < 10; i ++)"表示它可能只处理很短的时间后,就跳出循环,往下执行了