Solved

Open File Please Help

Posted on 2000-04-13
3
215 Views
Last Modified: 2010-04-02
I need to know how to read data from atext file and display it
in Single Document Interface by using MFC in Visual c++.
0
Comment
Question by:catdaddy123
3 Comments
 
LVL 1

Expert Comment

by:MT_MU
ID: 2713614
The method with the least coding...

Use app wizard to create a SDI application.

When the Wizard gets to the step where it shows the classes it is about to create for you - Select the "view" class and change it's base class to CEditView.

0
 
LVL 6

Expert Comment

by:graham_k
ID: 2714242
0
 
LVL 10

Accepted Solution

by:
RONSLOW earned 50 total points
ID: 2714554
Look at the Multipad sample in MFC.

It is a MDI example, but shows you how to read and write the text file etc.  In particular, look at the document class which has only one function overriden to do this:

void CPadDoc::Serialize(CArchive& ar)
{
  ((CEditView*)m_viewList.GetHead())->SerializeRaw(ar);
}

Then use AppWizard to create an SDI document/view app with the view based on CEDitView.

Make the appropriate changes/additions as per MultiPad for reading and writing the file (like the above), and you're done.

You might also then want to add a toolbar as in Multipad.

Then, when you've had enough of that .. look at SuperPad, which adds a heap of functionality to give you a really nice text editor.

here are the extra that SuperPad shows you how to do:
>About dialog box showing system resource usage.
>Splash window that is displayed when the application first starts.
>Persistent window placement by storing window position information in a private .ini file.
>Idle loop processing.
>Using a wait cursor.
>Subclassing a window.
>Adding page headers and footers during printing.
>Page breaking during printing.
>Starting print preview at the current selection in the document.
>Returning from print preview to the same position in the document as last previewed.
> Standard font dialog box (CFontDialog).

PS: This question really belongs in the MFC area.

0

Featured Post

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!

Question has a verified solution.

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

This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…

679 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