This is a sample simple use of CEditView.
Start by using the AppWizard to generate a SDI or MDI application that uses CEditView
for the View. (The following description is based on version 5 of VC; it might be a little
different for VC 6.) You would specify CEditView in the final page of the AppWizard dialog
pages. When AppWizard displays the list of classes to generate, it provides the ability to
specify what view to use. That is where you would want to specify CEditView. When you
compile the generated application as-is you will have an application that does most
everything Notepad does.
Note that somewhere in the AppWizard dialog boxes there is a way to specify file
extensions and related constants for your document. You would probably want to specify txt
for your document. Instead of doing that, though, it is also possible to modify the
document parameters after the application has been generated. See Q129095 - INFO:
Format of the Document Template String for documentation of that. Modification of the
Document Template String is also a good idea after application generation because there
are customizations there that can be modified only in that manner.
The generated application will not have "Select All", "Find" and
"Find and Replace" in the Edit menu or as keybord shortcuts but they can be easily
added. Add the following Accelerator resources:
Add the following menu items to your Edit menu:
That is all you need to do. MFC will do the rest.
Also, the generated application will have "Tile" menu item in the
"Window" menu but you can easily provide both "Tile Vertically" and
"Tile Horizontally". Change the "Tile" menu item to:
The modification in HOWTO: How to Save and Restore State of Dockable Toolbars
is easy, except I am not sure whether it is necessary for Visual C++ version 6.
The article does not list versions above 4 but the article seems to apply to
version 5 at least. One important detail is that you will probably get an
assertion unless you put the call to LoadBarState at the bottom of OnCreate, but
that is not clear in the KB article.