Annotation of mstools/mfc/samples/readme.txt, revision 1.1.1.2

1.1       root        1: ========================================================================
                      2:       MICROSOFT FOUNDATION CLASS LIBRARY : EXAMPLE CODE
                      3: ========================================================================
                      4: 
                      5: I. Introduction
                      6: 
                      7: This directory contains all of the Microsoft Foundation Class (MFC)
                      8: library example programs, which highlight many object-oriented
                      9: Windows programming techniques and class library features.  Each 
                     10: example is a complete and functional program that explores
                     11: different aspects of the library.
                     12: 
                     13: These programs are useful as learning tools, when used in conjunction
                     14: with the MFC reference documentation.  You can take the code provided
                     15: and experiment with it.  One group of sample programs, in the TUTORIAL
                     16: subdirectory, supplements the MFC Tutorial and should be studied in
                     17: conjunction with that document.
                     18: 
                     19: Each subdirectory has both PWB-compatible and NMAKE-compatible makefiles.
                     20: The PWB makefiles can be identified by the .MAK file extension.  NMAKE
                     21: makefiles are called 'makefile', with the exception of the TUTORIAL
                     22: subdirectory (the difference is explained in TUTORIAL\README.TXT).
                     23: 
                     24: -----------------------------------------------------------------------
                     25: Windows and C runtime libraries referenced by the makefiles should
                     26: be installed as part of the NT setup.  These libraries can be found
1.1.1.2 ! root       27: in \MSTOOLS\LIB.
1.1       root       28: -------------------------------------------------------------------------
                     29: 
                     30: II. Compiling sample programs with Microsoft NMAKE
                     31: 
                     32: To compile a sample program with NMAKE:
                     33: 
                     34: 1. Ensure you have the appropriate C runtime and Foundation
1.1.1.2 ! root       35: runtime libraries.  All MFC library variants necessary to build
1.1       root       36: the samples are provided in binary form in MFC\LIB.
                     37: 
                     38: 
                     39: 2. Ensure you have set up your LIB, INCLUDE, and PATH environment variables
                     40: appropriately.  For example:
                     41: 
1.1.1.2 ! root       42:    set LIB=C:\MSTOOLS\LIB;C:\MSTOOLS\MFC\LIB
        !            43:    set INCLUDE=C:\MSTOOLS\H;C:\MSTOOLS\MFC\INCLUDE
        !            44:    set PATH=%PATH%;C:\MSTOOLS\BIN
1.1       root       45: 
                     46: Remember you must put the MFC\LIB and MFC\INCLUDE directories in
                     47: your LIB and INCLUDE paths, respectively, if you wish to compile
                     48: Foundation applications.
                     49: 
                     50: 3. Change your working directory to the appropriate sample file 
                     51: directory and invoke NMAKE.  
                     52: 
                     53: In most cases, invoking NMAKE with no arguments will compile and 
                     54: link the retail version of that directory's sample application.  
                     55: If you wish to build the debug version, specify 'DEBUG=1' on the 
                     56: NMAKE command line.  If you want to remove object, compiled resource, 
                     57: and executable files, specify the 'clean' target.  For example:
                     58: 
1.1.1.2 ! root       59:   cd \mstools\mfc\samples\about2
        !            60:   nmake                       ' creates retail version of about2.exe
1.1       root       61:   nmake clean                 ' removes about2.exe/.obj/.res
1.1.1.2 ! root       62:   nmake DEBUG=0               ' creates retail version of about2.exe
1.1       root       63:   nmake clean                 ' removes about2.exe/.obj/.res
1.1.1.2 ! root       64:   nmake DEBUG=1               ' creates debug version of about2.exe
1.1       root       65: 
                     66: Object and resource files are created in the current directory.
                     67: 
                     68: Compilation procedures for the tutorial subdirectory are slightly
                     69: different than is documented here.  See MFC\SAMPLES\TUTORIAL\README.TXT
                     70: for more information.
                     71: 
                     72: NOTE: See technical note MFC\DOC\TN007.TXT for special information
                     73: on setting up your Windows environment to handle Foundation library
                     74: debugging output.
                     75: 
                     76: 
                     77: -----------------------------------------------------------------------
                     78: 
                     79: III. Samples
                     80: 
                     81: Here is a list of the sample directories and an overview of their
                     82: content.  See below for more detailed explanations
                     83: 
                     84:        ABOUT2      simple dialog box example.
                     85:        CHART       a simple bar/line charting application.
                     86:        CTRLTEST    a control test driver showing custom controls.
                     87:        FILEVIEW    a simple text file viewer.
                     88:        HELLO       basic application described in the MFC Tutorial.
                     89:        HELLOAPP    an extremely simple MFC application.
                     90:        MDI         demonstrates how to program to the MFC MDI interface.
                     91:        MINMDI      a bare-bones MDI application.
                     92:        MINSVR      a minimal OLE server application.
                     93:        MINSVRMI    a minimal OLE server application with multiple inheritance.
                     94:        MULTIPAD    an MDI NOTEPAD application.
                     95:        OCLIENT     an example of an Object Linking and Embedding (OLE) client.
                     96:        OSERVER     a simple OLE server application (called BIBREF)
                     97:        RESTOOL     a simple non-Windows tool for Windows resources.
                     98:        SHOWFONT    a font attribute viewer.
                     99:        TEMPLDEF    a non-Windows tool for expanding C++ templates.
                    100:        TRACER      a Windows utility to view and set diagnostic trace options.
                    101:        TUTORIAL    source for tutorial examples.
                    102: 
                    103: -------------------------------------------------------------------------
                    104: 
                    105: ABOUT2\ABOUT2.EXE
                    106: 
                    107: This program is a re-implementation of the ABOUT program found in
                    108: Charles Petzold's book, "Programming Windows"; it has been written
                    109: using C++ and the Foundation classes.  ABOUT2 allows you to draw
                    110: either a rectangle or an ellipse in one of several colors in the
                    111: client area of a application main window.  The source code
                    112: illustrates the following concepts:
                    113: 
                    114:     - Simple Foundation application structuring.
                    115:     - Simple dialog box initialization and management.
                    116:     - Graphics Device Interface (GDI) wrapper classes.
                    117: 
                    118: -------------------------------------------------------------------------
                    119: 
                    120: CHART\CHART.EXE
                    121: 
                    122: This program implements a simple bar/line charting application.
                    123: You can enter a data set (list of integers), display the data in
                    124: bar or line chart form, print the chart, save the data to disk, 
                    125: and read in previously saved data.  The source code illustrates
                    126: the following concepts:
                    127: 
                    128:     - Dialog box management.
                    129:     - Document state management (dirty, clean).
                    130:     - Using GDI calls to draw a graph to a device context.
                    131:     - Using Foundation CFile and CArchive classes to save and
                    132:       restore user data.
                    133:     - Printing.
                    134: 
                    135: -------------------------------------------------------------------------
                    136: 
                    137: CTRLTEST\CTRLTEST.EXE
                    138: 
                    139: The main application (in DCONTROL.H, DCONTROL.CPP and DCONTROL.RC)
                    140: provides a simple frame window with a single menu to drive the tests.
                    141: This can be easily extended to drive additional tests.
                    142: 
                    143: All the examples are based off a the class CParsedEdit which
                    144: is derived from the standard Windows CEdit class.  CParsedEdit
                    145: provides a simple keyboard input filter to only allow numbers,
                    146: letters, control characters, combinations of the above or any
                    147: characters.
                    148: 
                    149: This sample also includes MUSCROLL.DLL, the "micro scrolling"
                    150: custom control provided in the Windows 3.1 SDK, as well as tests
                    151: for Pen Windows edit items (requires Windows for Pen).
                    152: 
                    153: The source code illustrates the following concepts:
                    154: 
                    155:        - example parsed edit control (CParsedEdit) derived from
                    156:                the standard Windows CEdit class.
                    157:        - bitmap buttons
                    158:        - owner draw/self draw controls
                    159:        - owner draw/self draw menus
                    160:        - using C++ to create controls for a dialog using Create
                    161:                member functions for the controls (not recommended,     
                    162:                DERTEST.CPP, DERTEST.DLG)
                    163:        - exporting custom controls and registering a new WndClass
                    164:                so the controls can be used by the dialog manager
                    165:                (the "PAREDIT" control class used in WCLSTEST.CPP
                    166:                and WCLSTEST.DLG).  These controls can be edited with the
                    167:                SDK dialog editor (DLGEDIT.EXE) as custom controls
                    168:                by typing in the class name "PAREDIT" and the
                    169:                hex representation of the PES_ styles.
                    170:        - using SubclassWindow/SubclassDlgItem to dynamically
                    171:                subclass a dialog control to add specialized behaviour
                    172:                (SUBTEST.CPP, SUBTEST.DLG).
                    173:        - example of an external control packed as a DLL (MUSCROLL.DLL)
                    174:                being used by C++ code with a special C++ wrapper class.
                    175:        - an example of a spin button using the external MUSCROLL.DLL.
                    176:        - examples of Windows for Pen special edit controls
                    177: 
                    178:        more advanced topics:
                    179:        - ON_CONTROL handler (in WCLSTEST.CPP responding to new
                    180:                        control notification PEN_INVALIDCHAR).
                    181:        - example of how style bits (PES_ style bits for the parsed
                    182:                edit) can be stripped off before the normal CEdit
                    183:                control is created.
                    184: 
                    185: The source code to this application should be read along with
                    186: Foundation technical note 14 (MFC\DOC\TN014.TXT) describing
                    187: custom controls and other topics.
                    188: 
                    189: 
                    190: -------------------------------------------------------------------------
                    191: 
                    192: FILEVIEW\FILEVIEW.EXE
                    193: 
                    194: This program implements a simple text file viewer.  Unlike 
                    195: Windows NotePad, this program places no limit on the size 
                    196: of the text file that may be viewed.  This program is for
                    197: viewing text files only, and not editing them.  The source code
                    198: illustrates the following concepts:
                    199: 
                    200:     - Foundation application structuring.
                    201:     - Use of the Foundation file classes as base
                    202:       classes for derivation and specialization.
                    203:     - Use of the GDI classes for graphical output.
                    204:     - Use of Message Maps for handling window scrolling.
                    205: 
                    206: 
                    207: -------------------------------------------------------------------------
                    208: 
                    209: HELLO\HELLO.EXE
                    210: 
                    211: Described in the MFC Tutorial, this application shows the basics of
                    212: using the Microsoft Foundation Class Library to write applications
                    213: for the Microsoft Windows environment.  This application creates and
                    214: displays a fully-functional frame window, which in turn displays a
                    215: text string in its center.  The source code illustrates the following
                    216: concepts:
                    217: 
                    218:     - Simple Foundation application structuring.
                    219:     - Integrating Windows resources with your application.
                    220: 
                    221: -------------------------------------------------------------------------
                    222: 
                    223: HELLOAPP\HELLOAPP.EXE
                    224: 
                    225: This is an extremely simple MFC application that simply creates a
                    226: main frame window with the caption 'Hello World!'.  It is compiled
                    227: using retail libraries only.
                    228: 
                    229: -------------------------------------------------------------------------
                    230: 
                    231: MDI\MDI.EXE
                    232: 
                    233: The MDI application demonstrates how to program to the MFC wrapper of 
                    234: the Windows Multiple Document Interface (MDI) wrapper.  When started,
                    235: the MDI application provides an MDI frame window, and two kinds of MDI
                    236: child windows that you may open within the frame.  One child window
                    237: is similar to the HELLO example program (it displays "Hello World"
                    238: in its client area).  The other kind of child window contains a 
                    239: bouncing ball.  The source code illustrates the following concepts:
                    240: 
                    241:     - Foundation MDI application structuring.
                    242:     - Coordinating MDI frame and child classes.
                    243:     - Using Windows timers.
                    244:     - Using the CBitmap class for constructing and drawing a
                    245:       bit pattern into a device context.
                    246: 
                    247: -------------------------------------------------------------------------
                    248: 
                    249: MINMDI\MINMDI.EXE
                    250: 
                    251: This is a bare-bones MDI application that concentrates on showing the
                    252: minimum work needed to set up and maintain MDI child windows within
                    253: an MDI frame window.  You can use this application as a starting point
                    254: for your own experimentation with the MDI interface.  The source code
                    255: illustrates the following concepts:
                    256: 
                    257:     - Foundation MDI application structuring.
                    258:     - Coordinating MDI frame and child classes.
                    259: 
                    260: -------------------------------------------------------------------------
                    261: 
                    262: MINSVR\MINSVR.EXE
                    263: 
                    264: MINSVR is a minimal OLE server application that implements
                    265: a graphical ellipse drawing.  When running MINSVR *directly* (from
                    266: the program manager, file manager, or an icon), MINSVR is registered
                    267: with the registration data base.  YOU MUST RUN MINSVR DIRECTLY before
                    268: you can use it with other OLE programs.  Once you have run MINSVR
                    269: directly, you can use it with OLE Clients where it provides basic
                    270: embeddable object services.
                    271: 
                    272: The source code illustrates the following concepts:
                    273: 
                    274:     - Constructing a minimal OLE server
                    275:     - Programming with the MFC OLE classes
                    276:     - Supporting embedded objects
                    277: 
                    278: It is highly recommended that you read Foundation technical notes 8, 9,
                    279: and 10 (MFC\DOC\TN008.TXT, etc.) for more information on the MFC OLE
                    280: classes and constructing OLE clients and servers using MFC.
                    281: 
                    282: 
                    283: -------------------------------------------------------------------------
                    284: 
                    285: MINSVRMI\MINSVRMI.EXE
                    286: 
                    287: MINSVRMI is a simple OLE server application that implements a
                    288: graphical elliptical drawing.  It is the same program as MINSVR
                    289: except it is implemented using multiple inheritance.  When MINSVRMI is
                    290: *directly* run, it registers itself with the registration database. 
                    291: YOU MUST RUN MINSVRMI directly before using it with other OLE
                    292: programs.  When run from an OLE client, MINSVRMI allows you to embed
                    293: objects in the client application's document.
                    294: 
                    295: The source code illustrates the following concepts:
                    296: 
                    297:     - Constructing a minimal OLE server
                    298:     - Programming with the MFC OLE classes
                    299:     - Using multiple inheritance with MFC and MFC OLE classes
                    300:     - Supporting embedded objects
                    301: 
                    302: It is highly recommended that you read Foundation technical notes 8, 9,
                    303: and 10 (MFC\DOC\TN008.TXT, etc.) for more information on the MFC OLE
                    304: classes and constructing OLE clients and servers using MFC.
                    305: 
                    306: You should also read Foundation technical note 16 (MFC\DOC\TN016.TXT)
                    307: for more information on MFC and multiple inheritance.
                    308: 
                    309: -------------------------------------------------------------------------
                    310: 
                    311: MULTIPAD\MULTIPAD.EXE
                    312: 
                    313: Microsoft Windows provides a simple application called NOTEPAD.  The
                    314: MFC library adaptation of this program uses the MDI paradigm to allow
                    315: the user to manipulate any number of concurrently open text files. 
                    316: MULTIPAD is fully functional and includes printing support as well as
                    317: other features usually found only in commercial Windows applications:
                    318: a status bar at the bottom of the window, and a cache of
                    319: most-recently-used filenames (saved between program invocations) so
                    320: that users may quickly access recently used documents.  The source
                    321: code illustrates the following concepts:
                    322: 
                    323:     - Non-trivial MDI application structuring.
                    324:     - Menu command dispatching.
                    325:     - Dialog box initialization and management.
                    326:     - Printing.
                    327:     - Porting existing Windows code for use with MFC.
                    328:     - Swap tuning an application for Windows for maximum efficiency.
                    329: 
                    330: 
                    331: -------------------------------------------------------------------------
                    332: 
                    333: OCLIENT\OCLIENT.EXE
                    334: 
                    335: OCLIENT is an example of an Object Linking and Embedding (OLE) client
                    336: application.  It uses the Foundation OLE classes.  This program is a port
                    337: of the OLEDEMOC program which is shipped by the Microsoft OLE Software
                    338: Development Kit.  The program allows you to insert both embedded and
                    339: linked objects into a document.  OCLIENT also allows you to perform both
                    340: file and clipboard operations on the objects as well as activate the
                    341: servers to which the objects belong. The source code illustrates the
                    342: following concepts:
                    343: 
                    344:     - OLE client programming using MFC
                    345:     - Inserting embedded objects into a client
                    346:     - Pasting linked and embedded objects into a client
                    347:     - Copying objects to the clipboard
                    348:     - Loading and saving objects to and from disk
                    349: 
                    350: It is highly recommended that you read Foundation technical notes 8, 9,
                    351: and 10 (MFC\DOC\TN008.TXT, etc.) for more information on the MFC OLE
                    352: classes and constructing OLE clients and servers using MFC.
                    353: 
                    354: -------------------------------------------------------------------------
                    355: 
                    356: OSERVER\BIBREF.EXE
                    357: 
                    358: BIBREF is a simple OLE server application that implements
                    359: bibliographical references.  When BIBREF is *directly* run, it
                    360: registers itself with the registraton database and allows you to add,
                    361: modify, and delete bibliographical references from a list maintained
                    362: by the application.  YOU MUST RUN BIBREF DIRECTLY before using it
                    363: with other OLE programs.  When run from an OLE client, BIBREF allows
                    364: you to embed objects containing these references in the client
                    365: application's document.
                    366: 
                    367: The source code illustrates the following concepts:
                    368: 
                    369:     - Constructing an OLE server
                    370:     - Programming with the MFC OLE classes
                    371:     - Supporting embedded objects
                    372: 
                    373: It is highly recommended that you read Foundation technical notes 8, 9,
                    374: and 10 (MFC\DOC\TN008.TXT, etc.) for more information on the MFC OLE
                    375: classes and constructing OLE clients and servers using MFC.
                    376: 
                    377: 
                    378: -------------------------------------------------------------------------
                    379: 
                    380: RESTOOL\RESTOOL.EXE
                    381: 
                    382: RESTOOL is a simple non-Windows application that reads a Microsoft
                    383: Windows compiled resource (.RES) file and generates C++ class
                    384: declarations for any dialog boxes found in the resource file.
                    385: This allows you to quickly put together MFC CDialog-derived classes
                    386: that manipulate dialog boxes you already use in existing applications.
                    387: 
                    388: RESTOOL's output must be reviewed before using (RESTOOL uses some
                    389: heuristics that are not universally applicable) and you must put the 
                    390: generated code into a proper C++ header file.  The source code
                    391: illustrates the following concepts:
                    392: 
                    393:     - Using MFC libraries to write a non-Windows application.
                    394:     - Microsoft Windows resource file format.
                    395: 
                    396: 
                    397: -------------------------------------------------------------------------
                    398: 
                    399: SHOWFONT\SHOWFONT.EXE
                    400: 
                    401: This program is a C++/Foundation adaptation of a sample application
                    402: provided in the Microsoft Windows 3.0 Software Development Kit (SDK).
                    403: SHOWFONT is a font attribute viewer.  It allows you to quickly
                    404: determine the visual and logical characteristics of Windows GDI FONT
                    405: resources.  The source code illustrates the following concepts:
                    406: 
                    407:     - Modal and modeless dialog box management.
                    408:     - CFont attribute manipulation.
                    409:     - Menu command dispatching.
                    410: 
                    411: 
                    412: -------------------------------------------------------------------------
                    413: 
                    414: TEMPLDEF\TEMPLDEF.EXE
                    415: 
                    416: TEMPLDEF is a non-Windows tool that helps you write and use 
                    417: template-like classes.  Templates are a proposed (but not established)
                    418: C++ language feature that are very useful for industrial-strength
                    419: programming.  The MFC library's collection classes use template
                    420: classes (and the tool provided in this directory) to create specific
                    421: collection types from general collection types.
                    422: 
                    423: The C++ language will someday support such features, but this tool
                    424: makes some of these proposed advantages available now.  TEMPLDEF
                    425: reads a "template" file, and writes a new C++ class which is
                    426: type-safe.
                    427: 
                    428: After you have built the templdef tool, you can use the MKCOLL.BAT
                    429: batch file and the array, list, and map template files (all in the
                    430: TEMPLDEF subdirectory) to generate your own versions of arrays,
                    431: lists, and maps.
                    432: 
                    433: For more information on the templdef tool, see MFC Technical Note #4,
                    434: "Template Classes and AFX" (located in MFC\DOC\TN004.TXT).  For more
                    435: information on proposed C++ templates, see Chapter 14 of "The Annotated
                    436: C++ Reference Manual," by Ellis and Stroustrup.
                    437: 
                    438: 
                    439: 
                    440: -------------------------------------------------------------------------
                    441: 
                    442: TRACER\TRACER.EXE
                    443: 
                    444: TRACER is a tiny Windows utility that allows you to view and set the 
                    445: Foundation Windows diagnostic trace option flags described in 
                    446: MFC\DOC\TN007.TXT.  The source code illustrates the following concepts:
                    447: 
                    448:     - Reading and writing Windows profile strings
                    449:     - Writing a Foundation application that uses a modal dialog
                    450:       box but does not use the regular Windows/MFC message pump.
                    451: 
                    452: 
                    453: -------------------------------------------------------------------------
                    454: 
                    455: TUTORIAL\PHBOOK.EXE
                    456: 
                    457: PHBOOK is a phone list maintenance application, and is the subject
                    458: of the MFC tutorial.  PHBOOK allows you to create, edit, print and
                    459: save lists of people's names and their telephone numbers.  In addition
                    460: to MFC application programming techniques, this application demonstrates 
                    461: the development of an abstract data model and the coupling of that
                    462: data model to a graphical user interface implemented with MFC.  See
                    463: TUTORIAL\README.TXT for more information on building this application.
                    464: The source code illustrates the following concepts:
                    465: 
                    466:     - MFC Application organization.
                    467:     - Printing.
                    468:     - Dialog box management.
                    469:     - Coupling an abstract data model to a user interface.
                    470:     - Using MFC object serialization (CArchive class) to save
                    471:       and load user data.
                    472: 
                    473: -------------------------------------------------------------------------

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.