对话框中有一CEdit控件,其绑定到m_strLog。并有一定时器,定时时间(如1s)到时,this->UpdateData(FALSE),CEdit中显示相应m_strLog(其内容是慢慢增加的),问题出现了:CPU使用率在增加了,如何解决?
OnTimer函数内:
case TIMER0: // Êý¾Ý½ÓÊÕ¶¨Ê±Æ÷
this->UpdateData(FALSE); // 更新对话框中CEdit内容
其他处:
strLog += str;
OnTimer函数内:
case TIMER0: // Êý¾Ý½ÓÊÕ¶¨Ê±Æ÷
this->UpdateData(FALSE); // 更新对话框中CEdit内容
其他处:
strLog += str;
OnTimer函数内:
case TIMER0:
this->UpdateData(FALSE); // 更新对话框中CEdit内容
其他处:
strLog += str;
在Proprites中把Mulitiline选上.我觉得你这样做效率不好
可以这样试试int nLen = m_strLog.GetWindowTextLength(); //得到CEdit文本的长度
m_strLog.SetSel(nLen,nLen);
m_strLog.ReplaceSel(pszText);//pszText是你要加的文本.