Solved

Updating an edit box

Posted on 1998-09-15
10
155 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
set up trigger (or something) to rename files (starting with ATL) in a linux directory 6 53
mapAB Challlenge 35 124
Thin secure Windows 10 5 74
Making an alias 7 79
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
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.

911 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

24 Experts available now in Live!

Get 1:1 Help Now