15,979
社区成员
发帖
与我相关
我的任务
分享
void CTestDlg::AppResultString(CString str)
{
CEdit *pEdit = (CEdit *)GetDlgItem(IDC_OUTPUT); // Edit控件
CString strBuffer; // current contents of edit control
if (pEdit->GetLineCount() < 100 ) // 100是限制最大行数
pEdit->GetWindowText (strBuffer);
// Append string
if (!strBuffer.IsEmpty())
strBuffer += "\r\n";
COleDateTime dt = COleDateTime::GetCurrentTime();
CString time = dt.Format("%H:%M:%S");
strBuffer += time;
strBuffer += " ";
strBuffer += str;
pEdit->SetWindowText (strBuffer);
// Scroll the edit control
pEdit->LineScroll ( pEdit->GetLineCount(), 0);
}