Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. CEdit max text size (MFC, VC++6, WinXP)

CEdit max text size (MFC, VC++6, WinXP)

Scheduled Pinned Locked Moved C / C++ / MFC
c++helptutorial
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    im79
    wrote on last edited by
    #1

    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

    D A S 3 Replies Last reply
    0
    • I 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

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      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

      1 Reply Last reply
      0
      • I 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

        A Offline
        A Offline
        Anurag Gandhi
        wrote on last edited by
        #3

        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.

        1 Reply Last reply
        0
        • I 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

          S Offline
          S Offline
          Stephen Hewitt
          wrote on last edited by
          #4

          Try checking out the EM_SETLIMITTEXT[^] message.

          Steve

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups