Solved

Updating an edit box

Posted on 1998-09-15
10
154 Views
Last Modified: 2013-11-20
I've got a VC5 dialog app that has an edit box as it's main window & was started w/ the wizard plain & simple. This edit box has a member CString and I update the box using Invalidate() & UpdateWindow. from inside a thread. For some reason it stops updating after several hundred lines. If I save the member Cstring to a file then open it back up, all the data apperas in the edit box. This is the code in the thread

UINT CTestDlg::AsyncThread(void * pParam)
{
      CMyDlg *pDlg = (CMyDlg *)pParam;
      CEdit* pOutputScreen = (CEdit*)pDlg->GetDlgItem(IDC_OUTPUT_SCREEN);
        :
      while(pDlg->m_bRunAsync)
      {
            str = GetSomeInfo();
            :
            pDlg->m_strOutputScreen += str;                              
            pDlg->SetDlgItemText(IDC_OUTPUT_SCREEN, pDlg->m_strOutputScreen);
            pOutputScreen->Invalidate();
            pOutputScreen->UpdateWindow();
            :
      }

      return 0;    // thread completed successfully
}

Any suggestions on why the box just stops updating? And no, I did not set a limit on the number of chars when I created the Cstring for the edit control.
0
Comment
Question by:Grailman
  • 3
  • 3
  • 2
  • +1
10 Comments
 
LVL 2

Expert Comment

by:jrmcg
ID: 1322149
An edit box will only hold a certain amount of text.  Once it reaches its limit it is pretty much useless.  You might want to try and use a RichEdit control.  I believe you can  use that to do what you are needing.
0
 
LVL 1

Author Comment

by:Grailman
ID: 1322150
I'm able to run the app just fine in NT writting 700KB to the edit box but in Windows95 I can't write more than about 38K to the edit box. There is over 25MB memory free so that is ok. I can cut & paste 700KB or more into the edit box, and the CString I use for the edit box will correctly hold the 700KB when I store it to a file... I just can't display it via my app
0
 
LVL 6

Expert Comment

by:thresher_shark
ID: 1322151
jrmcg is correct.  There is a limit on the amount of stuff you can put in the edit box.  Just run Windows Notepad and see how much you can fit in there.....
0
 
LVL 2

Expert Comment

by:jrmcg
ID: 1322152
thanks, thresher
I still believe I am correct about the RichEdit control also.
Although the functions of the RichEdit differ from the regular edit box,  you will still be able to do what you have described, and fit more into the box.

J.R.
0
 
LVL 1

Author Comment

by:Grailman
ID: 1322153
But what diffrence is there for this app running on 95 or NT? As I said it works fine on NT but not on 95... ?
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 6

Expert Comment

by:thresher_shark
ID: 1322154
I don't know about any specific differences between '95 and NT, but I know that NT does have some features that '95 does not when it comes to programming (simply browsing through functions in the help system will reveal many items stating "NT Specific" or "NT Only").
0
 
LVL 2

Expert Comment

by:jrmcg
ID: 1322155
I'm not sure why this happens, I don't use NT or develop for it.  There are functions called GetLimitText and SetLimitText for both the CEdit and CRichEditCtrl classes that are supposedly for Win95 but I have tried to set the limit and it doesn't seem to work.  If you GetLimitText it will return a value of 30000 bytes.  From what I have seen, raising or lowering the limit does not help.

Maybe someone else will know that one.

Regards,
J.R.
0
 
LVL 8

Expert Comment

by:Answers2000
ID: 1322156
>> But what diffrence is there for this app running on 95 or NT? As I said it works fine on NT but not on 95... ?

95's edit control is implemented as 16bit (hence the limit on text).  The 32 bit version simply calls the 16 bit version

NT's edit control is trully 32bit, hence the bigger limit.

0
 
LVL 1

Author Comment

by:Grailman
ID: 1322157
Answers2000:
That was my brainfade, not thinking about 95s 16 bit architecture :-{  What threw me was that the CEdit::SetLimitText description didn’t mention this (though it did in “EM_SETLIMITTEXT” Win32 documentation). Anyway since you reminded me of the architecture differences, thus explaining why it didn’t work as I wanted, if you lock the question I’ll award you the points.

0
 
LVL 8

Accepted Solution

by:
Answers2000 earned 50 total points
ID: 1322158
Thanks Grailman
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now