Solved

Updating an edit box

Posted on 1998-09-15
10
158 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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
 
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Sed question 2 125
SQUD PROXY SERVER, UNIX, SLL/HTTPS 5 118
how to split multiple lines delimiter : 8 120
Capture logon name 13 106
Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
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. …
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.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

697 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