Link to home
Start Free TrialLog in
Avatar of Grailman
Grailman

asked on

Updating an edit box

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.
Avatar of jrmcg
jrmcg

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.
Avatar of Grailman

ASKER

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
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.....
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.
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... ?
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").
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.
>> 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.

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.

ASKER CERTIFIED SOLUTION
Avatar of Answers2000
Answers2000

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial