home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c480 / 19.ddi / SAMPLES / MAKEAPP / MAKEAPP.TX_ / MAKEAPP.TX
Encoding:
Text File  |  1993-02-08  |  7.5 KB  |  197 lines

  1.         MAKEAPP Application Project Generator
  2.         -------------------------------------
  3.  
  4. The MAKEAPP project generator is both a utility that will generate a template
  5. Windows application for you, and a sample application that illustrates the
  6. use of STRICT and windowsx.h.
  7.  
  8. The MAKEWC utility generates new window class source file for you, which can
  9. be integrated into an application generated with MAKEAPP.
  10.  
  11.         Using MAKEAPP to generate Windows application projects
  12.         ------------------------------------------------------
  13.  
  14. The MAKEAPP utility will generate a template application project for you.
  15. Besides copying the template application, it renames the various files,
  16. functions, and constants throughout the makefile and source files to names of
  17. your choice.
  18.  
  19. To generate an application, just CD to the directory that contains makeapp
  20. and type:
  21.  
  22.     makeapp destdir modulename ClassName
  23.  
  24. where:
  25.  
  26.  
  27.     destdir     is the project directory you want files copied to,
  28.  
  29.     modulename  is the name of the application executable (excluding .exe)
  30.  
  31.     ClassName   is the name you want to use in the source for the window
  32.                 class and other identifiers.
  33.  
  34. For example:
  35.  
  36.     makeapp c:\myapp myapp MyApplication
  37.  
  38. will copy the sources to build myapp.exe into the directory c:\myapp.  The
  39. application will create two window classes: MyApplication_Frame and
  40. MyApplication_Client, which you can modify to add your own code.
  41.  
  42.  
  43.         Using MAKEWC to generate a window class source
  44.         ----------------------------------------------
  45.  
  46. The MAKEWC utility will generate source code for a template window class for
  47. you.  Like MAKEAPP, it renames various aspects of the source code for you
  48. based on parameters you specify.
  49.  
  50. To generate a new window class, just CD to the directory that contains
  51. makeapp and type:
  52.  
  53.     makewc destdir filename ClassName TYPENAME ptrtype AppPrefix_ appname
  54.  
  55. where:
  56.  
  57.     destdir     is the project directory you want files copied to
  58.  
  59.     filename    is the name of the window class source and include file
  60.                 (excluding the .c or .h)
  61.  
  62.     ClassName   is the class name used for function name prefixes
  63.                 (i.e., ClassName_OnCommand, etc)
  64.  
  65.     TYPENAME    is the name of the instance data structure type
  66.                 (i.e., sizeof(TYPENAME));
  67.  
  68.     ptrtype     is the name to use for pointers to instance data
  69.                 (i.e., TYPENAME* ptrtype; )
  70.  
  71.     AppPrefix_  is the class name prefix to use for the registered
  72.                 classname.  The underscore must be included.
  73.                 (i.e., CreateWindow(..., "AppPrefix_ClassName", ...); )
  74.  
  75.     appname     is the name of the main application header file
  76.                 (i.e., #include "appname.h")
  77.  
  78. For example:
  79.  
  80.     makewc c:\myapp mywnd MyWnd MYWND pmwnd MyApp_ myapp
  81.  
  82. will create the files mywnd.c and mywnd.h in c:\myapp, that implement the
  83. window class named MyApp_MyWnd.
  84.  
  85. To use this new window class source, you will need to update your makefile to
  86. ensure the file is compiled and linked.  You will also need to update your
  87. project's include file to ensure that the window class header file is included.
  88.  
  89.  
  90.         How they work
  91.         -------------
  92.  
  93. MAKEAPP and MAKEWC are fairly simple batch files that copies the template
  94. files from the MAKEAPP directory to the directory you specify.  Some file
  95. names, constants and function names in the copied source file are renamed
  96. according to the parameters you provide.
  97.  
  98. The program REP.EXE is used to perform the global search-and-replace
  99. operations required, and is called by makeapp2.bat.
  100.  
  101.  
  102.         Template application architecture
  103.         ---------------------------------
  104.  
  105. The template application is fully STRICT, and provides examples of the
  106. features of windowsx.h: macro APIs, control APIs, and message crackers.
  107.  
  108. The application is designed to be easy to modify and add features to. It's
  109. architecture is typical of a medium-sized Windows application: there is a
  110. top-level "frame" window that manages the menus, which contains a "client"
  111. child window that is sized to fit inside the client area.  A sample dialog
  112. box is also shown.
  113.  
  114. You can use the 3.1 SDK dialog editor to edit the dialog box template
  115. resources.
  116.  
  117. The application is divided into four main modules:
  118.  
  119.         app
  120.  
  121.     Contains the Windows application entry point (WinMain), handles
  122.     application initialization and termination, and implements the
  123.     application main loop and idle function.
  124.  
  125.         frame
  126.  
  127.     Implements the main window of the application.  The "frame" window
  128.     defines the menu, and deals with other main-window responsibilities such
  129.     as activation, application termination (with cooperation from the client
  130.     window).  It arranges its child "client" window to occupy its client
  131.     area. The frame window handles a few commands, but those it does not
  132.     process are passed on to the client window.
  133.  
  134.         client
  135.  
  136.     The client window is responsible for the "client area" of the main
  137.     application window.  It handles window painting, commands passed to it
  138.     from the frame, focus, mouse input, and keyboard input, and the like.
  139.     Handles the Sample/Dialog command, which brings up the sample dialog box.
  140.  
  141.         dlg
  142.  
  143.     Implements a sample dialog box, using message crackers and the control
  144.     APIs.
  145.  
  146.     makeapp.h simply #includes all the include files required by this
  147.     application.
  148.  
  149.     dlgdefs.h includes all of the definitions used in dialog boxes.  These
  150.     are split into a separate .h file so it can be conveniently used with
  151.     the 3.1 SDK Dialog Editor.
  152.  
  153.     makeapp.dlg includes all of the dialog templates.  These are created
  154.     and edited using the 3.1 SDK Dialog Editor.
  155.  
  156.  
  157.         Making changes to MAKEAPP template application
  158.         ----------------------------------------------
  159.  
  160. You can make changes to the template application to suit your preferences:
  161. change the indentation style, modify the makefile to use a different compiler
  162. or different compiler switches, add or remove features, or whatever.  Then,
  163. each time you run the makeapp batch file, the new application project will
  164. reflect your changes.
  165.  
  166. As template files are copied, certain keywords in the source files are
  167. replaced with parameters specified on the command line.  So if you're writing
  168. code that you want renamed in some way, you must use these keywords.
  169.  
  170.     makeapp     - Changed to the modulename parameter.
  171.     MakeApp     - Changed to the ClassName parameter
  172.  
  173. You'll need to modify makeapp.bat if you add (or remove) source files to the
  174. project.
  175.  
  176. You can build the template application in the makeapp directory by typing
  177. "nmake", assuming you have installed the SDK and the MS C 6 compiler.  This
  178. will produce the windows application executable makeapp.exe.  If this file
  179. exists and you try to run makeapp.bat, you'll get the "this application
  180. requires Windows" message: to run the batch file you must delete makeapp.exe.
  181.  
  182.  
  183.         Making changes to MAKEWC template window class
  184.         ----------------------------------------------
  185.  
  186. The template window class is contained in the file MAKEWC.C and MAKEWC.H. In
  187. order to compile and test the template window class, you can create a project
  188. using makeapp that includes the MakeWc window class.
  189.  
  190. Replaced keywords are:
  191.  
  192.     MakeWc      - Class name
  193.     MAKEWC      - Class instance data type name
  194.     pmwc        - Class instance data pointer variable name
  195.     MakeApp_    - Application name classname prefix
  196.     makeapp     - Application file name
  197.