怎么可能,OnIdle是在主线程里运行的,要么运行OnIdle要么运行事件处理,不会同时执行的
解决方案 »
- mfc 鼠标左键拖动滚动条滚动,滚动条出现回滚问题
- 怎样在启动界面失后才出现主界面窗口,象金山词霸一样!
- MoveFile的问题
- 1111111111111111111111111111111111111111111111111111111111111
- 用MFC如何规划我的这个软件任务...(讨论者有分)
- ftpcommand不可用,那位知道,请告知!
- 關於媒體播放器
- 输入一段字符串,如果该字符串已在某一文件中,则执行某一特定的操
- 哪版的MSDN中有C#的介绍?
- 如何得到IE收藏夹的列表数据?
- MFC的CListBox中如何获取用户所点击条目的index?
- MFC中添加成员变量如何确定成员变量的类型
{
ASSERT_VALID(this);
_AFX_THREAD_STATE* pState = AfxGetThreadState(); // 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(&(pState->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 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))
if (IsIdleMessage(&(pState->m_msgCur)))
{
bIdle = TRUE;
lIdleCount = 0;
} } while (::PeekMessage(&(pState->m_msgCur), NULL, NULL, NULL, PM_NOREMOVE));
}
}