MULTIPAD Sample: Edits Files Simultaneously
The MULTIPAD sample is a simple text editor with a standard user interface. Essentially a multiple document interface (MDI) version of the Microsoft Windows Notepad application, MULTIPAD lets the user open and edit multiple text files at one time. The user interface is standard for text editors.
Earlier versions of MFC adapted and simplified the Windows MULTIPAD sample, taking advantage of MDI support in the library, and further simplified MULTIPAD by taking advantage of several new framework features, including toolbar, status bar, printing, and the CEditView class. See DLLHUSK for a simple illustration of deriving from CEditView and SUPERPAD for an advanced illustration.
Building and Running the Sample
To build and run the MULTIPAD sample
- Open the solution multipad.sln.
- On the Build menu, click Build.
- On the Debug menu, click Start Without Debugging.
The CEditView class uses a Windows edit control to hold the entire text document in memory while the user edits the document's contents. CEditView significantly extends the functionality of the edit control by handling the Edit menu Cut, Copy, Paste, Clear, Select All, Find, Replace, Repeat, and Undo commands and the File menu Print command. MULTIPAD does not need a CMDIChildWnd-derived class for the frame window, nor does it need to derive from CEditView. Serialization of the text file consists of one line of code: The document class object delegates serialization of the text file to the CEditView object.
This sample demonstrates the following keywords:
CFrameWnd::Create; CObject::Serialize; CWinApp::AddDocTemplate; CWinApp::EnableShellOpen; CWinApp::InitInstance; CWinApp::LoadStdProfileSettings; CWinApp::RegisterShellFileTypes; CWnd::OnCreate; DragAcceptFiles; LoadBitmap; ShowWindow
Note Some samples, such as this one, have not been modified to reflect the changes in the Visual C++ wizards, libraries, and compiler, but still demonstrate how to complete your desired task.