CEdit max text size (MFC, VC++6, WinXP)
-
Hello, I use the following funktion to write log info into a write protected CEdit window for debuging purposes: void CMyprogDlg::log(LPCTSTR lpszText) { long iBegin, iEnd; CString time; CString msg; time = m_CTime_time.Format("%d.%m %H:%M:%S"); msg.Format("[%s] %s", time, lpszText); iBegin = m_CEdit_log.LineIndex(-1); iEnd = iBegin + m_CEdit_log.LineLength(iBegin); m_CEdit_log.SetSel(iBegin, iEnd); m_CEdit_log.ReplaceSel(msg); } for example : log("blablabla\r\n"); It works well and i'm using it in alot of programs instead of stdout. The problems is that when i'm trying to put a lot text lines in the window, after a few hundred lines, the function doesn't work as supposed anymore. Instead of creating new lines, the new text replaces the last line. I'll be very greatfull for any help! Best Regards, im79
-
Hello, I use the following funktion to write log info into a write protected CEdit window for debuging purposes: void CMyprogDlg::log(LPCTSTR lpszText) { long iBegin, iEnd; CString time; CString msg; time = m_CTime_time.Format("%d.%m %H:%M:%S"); msg.Format("[%s] %s", time, lpszText); iBegin = m_CEdit_log.LineIndex(-1); iEnd = iBegin + m_CEdit_log.LineLength(iBegin); m_CEdit_log.SetSel(iBegin, iEnd); m_CEdit_log.ReplaceSel(msg); } for example : log("blablabla\r\n"); It works well and i'm using it in alot of programs instead of stdout. The problems is that when i'm trying to put a lot text lines in the window, after a few hundred lines, the function doesn't work as supposed anymore. Instead of creating new lines, the new text replaces the last line. I'll be very greatfull for any help! Best Regards, im79
Edit controls do have an upper limit (64KB comes to kind). Try this instead.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
-
Hello, I use the following funktion to write log info into a write protected CEdit window for debuging purposes: void CMyprogDlg::log(LPCTSTR lpszText) { long iBegin, iEnd; CString time; CString msg; time = m_CTime_time.Format("%d.%m %H:%M:%S"); msg.Format("[%s] %s", time, lpszText); iBegin = m_CEdit_log.LineIndex(-1); iEnd = iBegin + m_CEdit_log.LineLength(iBegin); m_CEdit_log.SetSel(iBegin, iEnd); m_CEdit_log.ReplaceSel(msg); } for example : log("blablabla\r\n"); It works well and i'm using it in alot of programs instead of stdout. The problems is that when i'm trying to put a lot text lines in the window, after a few hundred lines, the function doesn't work as supposed anymore. Instead of creating new lines, the new text replaces the last line. I'll be very greatfull for any help! Best Regards, im79
You can use RichEdit control to over come this drawback of CEdit control.
Anurag Gandhi. http://www.softgandhi.co.nr Life is a computer program and every one is the programmer of his own life.
-
Hello, I use the following funktion to write log info into a write protected CEdit window for debuging purposes: void CMyprogDlg::log(LPCTSTR lpszText) { long iBegin, iEnd; CString time; CString msg; time = m_CTime_time.Format("%d.%m %H:%M:%S"); msg.Format("[%s] %s", time, lpszText); iBegin = m_CEdit_log.LineIndex(-1); iEnd = iBegin + m_CEdit_log.LineLength(iBegin); m_CEdit_log.SetSel(iBegin, iEnd); m_CEdit_log.ReplaceSel(msg); } for example : log("blablabla\r\n"); It works well and i'm using it in alot of programs instead of stdout. The problems is that when i'm trying to put a lot text lines in the window, after a few hundred lines, the function doesn't work as supposed anymore. Instead of creating new lines, the new text replaces the last line. I'll be very greatfull for any help! Best Regards, im79
Try checking out the EM_SETLIMITTEXT[^] message.
Steve