I need to show a large text file ( <10M) to users in a dialog.
Meanwhile, the file is being appened with more data by a seperate
process.

I have little experience with MFC. I guess I should use RichEditCtrl
for this case. But I'm not sure if I should use SetDlgItemText(..) to
send file content to the control. This is Question 1.

Secondly, I'd like send only the newly appended part of the file to
the control for every refresh, instead of the whole file everytime.
Are there any existing functions/mechanisms in MFC for this purpose?

By the way, I have to use VC++ for the project (not VB, C#...).

Thanks,
-John

Re: How to display a text file dynamically? by Sheng

Sheng
Sun Oct 28 13:34:38 PDT 2007

Is the text file formated in anyway? If so, you wiill probably need a
listview or some sort of list.

--
Sheng Jiang
Microsoft MVP in VC++
<decentjohn@gmail.com> wrote in message
news:1193599967.946752.180660@19g2000hsx.googlegroups.com...
> I need to show a large text file ( <10M) to users in a dialog.
> Meanwhile, the file is being appened with more data by a seperate
> process.
>
> I have little experience with MFC. I guess I should use RichEditCtrl
> for this case. But I'm not sure if I should use SetDlgItemText(..) to
> send file content to the control. This is Question 1.
>
> Secondly, I'd like send only the newly appended part of the file to
> the control for every refresh, instead of the whole file everytime.
> Are there any existing functions/mechanisms in MFC for this purpose?
>
> By the way, I have to use VC++ for the project (not VB, C#...).
>
> Thanks,
> -John
>



Re: How to display a text file dynamically? by Scott

Scott
Sun Oct 28 17:52:12 PDT 2007

<decentjohn@gmail.com> wrote in message
news:1193599967.946752.180660@19g2000hsx.googlegroups.com...
>I need to show a large text file ( <10M) to users in a dialog.
> Meanwhile, the file is being appened with more data by a seperate
> process.
>
> I have little experience with MFC. I guess I should use RichEditCtrl
> for this case. But I'm not sure if I should use SetDlgItemText(..) to
> send file content to the control. This is Question 1.
>
> Secondly, I'd like send only the newly appended part of the file to
> the control for every refresh, instead of the whole file everytime.
> Are there any existing functions/mechanisms in MFC for this purpose?


If you need the control to do word-wrap for you at the end of lines then use
the edit control. Or if you need the ability to change colors and fonts in
different parts of the text use the rich edit control.

But if you don't need either of these features then the list box is a much
easier way to display scrolling lines of text.

The control's features are the same whether you use MFC or not. MFC just
provides a convenient wrapper around the Win32 control's SendMessage
functions. You can append text to an edit control with SetSel(-1, -1),
followed by ReplaceSel.

--
Scott McPhillips [VC++ MVP]


Re: How to display a text file dynamically? by Tom

Tom
Tue Oct 30 15:24:23 PDT 2007

An easy way to do this sort of thing is just use ShellExecute() to open the
file. If the type is .txt then Notepad (or whatever text viewer the user
has set) will open with the file.

Sounds like the file is updating regularly though, so perhaps that wouldn't
work as well. You certainly wouldn't want to load 10M into memory all the
time from the file. Perhaps you could look at some code like "tail" from
Unix and only display the last 'n' lines of the file and allow the user to
page down (or up in this case) to show more of the file...

http://www.codeproject.com/tools/Tail_for_Win32.asp

This idea would work nicely if the file contains "lines" of text.

Tom

<decentjohn@gmail.com> wrote in message
news:1193599967.946752.180660@19g2000hsx.googlegroups.com...
>I need to show a large text file ( <10M) to users in a dialog.
> Meanwhile, the file is being appened with more data by a seperate
> process.
>
> I have little experience with MFC. I guess I should use RichEditCtrl
> for this case. But I'm not sure if I should use SetDlgItemText(..) to
> send file content to the control. This is Question 1.
>
> Secondly, I'd like send only the newly appended part of the file to
> the control for every refresh, instead of the whole file everytime.
> Are there any existing functions/mechanisms in MFC for this purpose?
>
> By the way, I have to use VC++ for the project (not VB, C#...).
>
> Thanks,
> -John
>