home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c082_144 / 6.ddi / OWLDOC.ZIP / OWL.DOC < prev    next >
Encoding:
Text File  |  1992-06-10  |  20.2 KB  |  406 lines

  1. ===========================================================================
  2. ObjectWindows for C++
  3. ===========================================================================
  4.  
  5.                     This file contains important information about
  6.                     ObjectWindows for C++, an application framework that
  7.                     will ease the development of applications for Windows.
  8.                     For the latest information about ObjectWindows for C++,
  9.                     the accompanying example programs, and documentation,
  10.                     read this entire file.
  11.  
  12.               Note  There are many changes and enhancements to
  13.                     ObjectWindows in this release, to better support
  14.                     Windows 3.1. For more details, see OWL31.DOC.
  15.  
  16.  
  17.           Features  =======================================================
  18.  
  19.                     ObjectWindows for C++ includes the following important
  20.                     features:
  21.  
  22.  
  23. ------------------  DDVTs provide a simple alternative to the traditional
  24.   Dynamic Dispatch  method of writing a window procedure to responding to
  25.     Virtual Tables  Windows messages. Typically, a window procedure
  26.            (DDVTs)  consists of a lengthy switch statement with a case for
  27. ------------------  every Windows message to which you require a response.
  28.                     By using DDVTs, you respond to a Windows message by
  29.                     writing a member function of the C++ class associated
  30.                     with your window. Using DDVTs, your derived classes
  31.                     will not be encumbered with virtual table entries for
  32.                     all windows messages handled by the derived class and
  33.                     all base classes. DDVTs encode only the changed virtual
  34.                     member functions to keep virtual tables small.
  35.  
  36.  
  37. ------------------  ObjectWindows includes support for streamable
  38.        Support for  (persistent) objects. The stream manager lets you save
  39. streamable objects  objects either in memory or file streams so that they
  40. ------------------  persist beyond their normal lifespan.
  41.  
  42.  
  43. ------------------  The Borland Windows Custom Control Library (BWCC.DLL)
  44.     Borland custom  provided with this release allows you to build your own
  45.           controls  Windows programs using the fancy dialog boxes and
  46. ------------------  controls provided with such Borland Windows products as
  47.                     the Resource Workshop, Turbo Pascal for Windows, Turbo
  48.                     C++ for Windows, and Borland C++ for Windows.
  49.  
  50.  
  51. ------------------  ObjectWindows provides the ability to produce your own
  52.       Dynamic-link  ObjectWindows DLLs and use classes and functions from
  53.   libraries (DLLs)  these DLLs in your ObjectWindows applications.
  54. ------------------
  55.                     In addition to OWL31.DLL, this version includes dynamic
  56.                     link library versions of BWCC (Borland Windows Custom
  57.                     Controls), and BC30RTL (the Borland C++ run-time
  58.                     libraries within a DLL). More information on these
  59.                     appears below.
  60.  
  61.  
  62. ------------------  We provide Help files containing reference information
  63.        Online Help  on the ObjectWindows and Streamable classes. The Help
  64. ------------------  files are provided in two formats: one that is
  65.                     compatible with THELP and the DOS IDE and one that is
  66.                     compatible with the Windows Help engine (WINHELP).
  67.  
  68.  
  69. ------------------  To significantly improve the performance of dynamic
  70.        Global heap  heap allocations under Windows, the BC RTL provides new
  71.      suballocation  versions of the farmalloc, farfree, farrealloc, and
  72. ------------------  farcalloc functions which suballocate Windows global
  73.                     heap blocks. To take advantage of these functions, you
  74.                     need only use 'new' and 'delete' as usual.
  75.  
  76.  
  77.          Important  =======================================================
  78.        information
  79.  
  80.  
  81. ------------------  The User's Guide includes a step-by-step tutorial that
  82.      ObjectWindows  quickly introduces readers to many of the important
  83.       User's Guide  features of ObjectWindows and gets them off to a good
  84. ------------------  start in ObjectWindows programming.
  85.  
  86.                     In OWL\DOC, you will also find a file, OWLDLL.DOC, that
  87.                     contains a new chapter on using and building dynamic
  88.                     link libraries.
  89.  
  90.                     The BWCC-OWL.DOC file in OWL\DOC, and BWCCAPI.RW and
  91.                     BWCCSTYL.RW files in BORLANDC\DOC contain information
  92.                     on using the Borland Custom Controls with
  93.                     ObjectWindows.
  94.  
  95.                     If you have any questions that are not answered in the
  96.                     manuals, check out this file and the HELPME!.DOC
  97.                     file, which discuss questions and problems that
  98.                     ObjectWindows programmers may encounter.
  99.  
  100.  
  101. ------------------  The Borland Windows Custom Control Library (BWCC.DLL)
  102.     Borland custom  is provided with this release, along with its import
  103.           controls  library (BWCC.LIB). To use BWCC, you must specify the
  104. ------------------  Windows class name of any control you want to use in
  105.                     your resource files.
  106.  
  107.                     Whether you use BWCC from an ObjectWindows program or
  108.                     not, you will have to ensure that BWCC.DLL is
  109.                     dynamically loaded along with your program. The
  110.                     suggested way to do this is to update your program to
  111.                     make a call to BWCCGetVersion (defined in
  112.                     BORLANDC\INCLUDE\BWCC.H) from somewhere within your
  113.                     program. This will cause an imported reference to
  114.                     BWCC.DLL which will, in turn, cause the Windows loader
  115.                     to load BWCC.DLL along with your program (if it is not
  116.                     already loaded).
  117.  
  118.                     The CHECKERS and TTT (TicTacToe) games in the
  119.                     OWL\EXAMPLES directory use the Borland Windows Custom
  120.                     Controls.
  121.  
  122.                     See the files BWCC-OWL.DOC in the OWL\DOC subdirectory
  123.                     and BWCCAPI.RW and BWCCSTYL.RW files in BORLANDC\DOC
  124.                     for more information on using the Borland Custom
  125.                     Controls.
  126.  
  127.  
  128. ------------------  If you use DLLs, remember that they must be located in
  129.        DLL support  a directory in your path (eg, C:\BORLANDC\BIN or
  130. ------------------  C:\WINDOWS) or in the directory of the .EXE which
  131.                     invokes them.
  132.  
  133.                     By default, the INSTALL program will place OWL31.DLL,
  134.                     BC30RTL.DLL, and TCLASS31.DLL in your BORLANDC\BIN
  135.                     directory and BWCC.DLL in your WINDOWS\SYSTEM
  136.                     directory.
  137.  
  138.                     If you want to build the example programs to use the
  139.                     statically linked libraries rather than OWL31.DLL (the
  140.                     default for the makefile in OWL\EXAMPLES), you should
  141.                     define the USESTATIC macro on the make command line:
  142.  
  143.                          make -DUSESTATIC
  144.  
  145.                     If you are using OWL31.DLL, or any ObjectWindows DLL
  146.                     that you have built, you must use large model for both
  147.                     the DLLs and the EXEs that use them. Also, if you link
  148.                     your program to you use OWL31.DLL, then it should also
  149.                     be linked to use BC30RTL.DLL and TCLASS31.DLL;
  150.                     CRTLDLL.LIB and TCLASDLL.LIB are their import
  151.                     libraries.
  152.  
  153.                     If you want to build your own DLLs with ObjectWindows,
  154.                     we recommend that you check out the USECDLL and CALLDLL
  155.                     example programs.
  156.  
  157.                     The USECDLL example program demonstrates the use of a
  158.                     cooperating ObjectWindows EXE and DLL using an object
  159.                     interface (that is, shared classes). The CALLDLL
  160.                     example program shows an ObjectWindows EXE making a
  161.                     call into an ObjectWindows DLL using a functional
  162.                     interface. The USECDLL2 shows a non-OWL EXE calling
  163.                     into an ObjectWindows DLL.
  164.  
  165.                     If you want to define your own shared classes, define
  166.                     the _CLASSDLL macro in the Defines text box of the
  167.                     Options|Compiler|Code Generation dialog box or on the
  168.                     compiler command line to signify that the module being
  169.                     compiled will use classes in a DLL or will pass classes
  170.                     into a DLL. Other macros, notably _CLASSTYPE, _EXPORT,
  171.                     and _FAR, will check to see if _CLASSDLL has been
  172.                     defined.
  173.  
  174.                     Use the _EXPORT macro (defined in
  175.                     OWL\INCLUDE\OWLDEFS.H) in the definitions of your
  176.                     shared classes. It will expand into either '_CLASSTYPE'
  177.                     (when compiling an .EXE file) or '_export' (when
  178.                     compiling a .DLL module). Typical usage might be:
  179.  
  180.                          _CLASSDEF(TMyClass)
  181.                          class _EXPORT TMyClass
  182.                          {
  183.                               // whatever...
  184.                          };
  185.  
  186.                     The _CLASSTYPE macro (defined in
  187.                     BORLANDC\INCLUDE\_DEFS.H) expands into either "huge",
  188.                     "far", or "near" as appropriate. If the __DLL__ or
  189.                     _CLASSDLL macro is defined, _CLASSTYPE expands into
  190.                     "huge", since huge classes are required when classes
  191.                     are passed between an EXE and a DLL or between two DLLs
  192.                     (a huge class is a class which has a far 'this' pointer
  193.                     and a far virtual table pointer).
  194.  
  195.                     External functions that are exported from a library
  196.                     when it is built as a DLL should be declared with
  197.                     _EXPFUNC. This macro is defined in OWLDEFS.H and
  198.                     expands into '_export' when the source it appears in is
  199.                     compiled for a DLL(-WDE or -WD would be used if built
  200.                     with the command line compiler); otherwise, _EXPFUNC is
  201.                     replaced with the null string. For example, the
  202.                     following declaration appears in the APPLICAT.H header
  203.                     file:
  204.  
  205.                          extern PTApplication _EXPFUNC
  206.                                 GetApplicationObject();
  207.  
  208.  
  209.                     Note that ObjectWindows DLLs may only be built in large
  210.                     model.
  211.  
  212.                     Also note that, if you build an ObjectWindows
  213.                     application (.EXE) that uses one or more ObjectWindows
  214.                     DLLs, you must dynamically link your EXE with
  215.                     OWL31.DLL, TCLASS31.DLL, and BC30RTL.DLL. You cannot
  216.                     statically link your EXE with the OWLWx.LIB static link
  217.                     libraries.
  218.  
  219.                     More information on DLLs appears in the OWLDLL.DOC file
  220.                     in OWL\DOC.
  221.  
  222.  
  223. ------------------  We provide the complete source code and makefiles
  224.        Source code  needed for building the ObjectWindows (static and
  225. ------------------  dynamic link) libraries. When building the
  226.                     ObjectWindows libraries yourself, the .OBJ files
  227.                     produced will be placed in appropriate subdirectories
  228.                     of OWL\OBJECT by the makefile.
  229.  
  230.                     For example, the .OBJ files for the small memory model
  231.                     will be put in OWL\OBJECT\WS, while those for large
  232.                     model DLL will be placed in in OWL\OBJECT\DL.
  233.  
  234. ------------------  The OWL\EXAMPLES subdirectory contains many sample
  235.    Sample programs  programs that will help you get started in writing
  236. ------------------  ObjectWindows programs. The 'test' apps are typically
  237.                     short programs providing code samples that demonstrate
  238.                     various ObjectWindows classes and their features; these
  239.                     often correspond to discussions in the User's Guide.
  240.  
  241.                     The longer, more useful and interesting apps include
  242.                     MFILEAPP (an MDI editor), SWAT (a game), and PROGTALK
  243.                     (a DDE client that can add items and groups to the
  244.                     Windows program manager (a DDE server)). The TTT
  245.                     (TicTacToe) and CHECKERS examples make use of the
  246.                     Borland Windows Custom Controls. Using a dialog as a
  247.                     main window of a program is demonstrated in the SYSINFO
  248.                     (system information), CALC (calculator), and CURSOR
  249.                     (window information) examples.
  250.  
  251.                     We provide a MAKEFILE for building the examples. You
  252.                     may want to use this as a template for writing your own
  253.                     makefiles. The MAKEFILE uses a make include file,
  254.                     MAKEFILE.INC, which defines the macros used by the
  255.                     makefiles in OWL\EXAMPLES and its subdirectories. If
  256.                     you installed ObjectWindows under your BORLANDC
  257.                     directory (the default), and if your BORLANDC
  258.                     subdirectories use the default names (BIN, INCLUDE,
  259.                     LIB, CLASSLIB), then you will only have to redefine the
  260.                     BCROOT macro within MAKEFILE.INC to use these
  261.                     makefiles.
  262.  
  263.                     The OWL\EXAMPLES subdirectory also contains project
  264.                     (.PRJ) files for building the sample programs with the
  265.                     IDE. If you didn't use the standard directories when
  266.                     you installed Borland C++ or ObjectWindows, and you
  267.                     want to build example programs that come with .PRJ
  268.                     files, you may have to change the .PRJ file to reflect
  269.                     your actual directory setup. Do this from in the IDE
  270.                     with the Options|Directories dialog box.
  271.  
  272.  
  273. ------------------  The OWL directory contains a batch file BUILDOWL.BAT
  274.       Building the  which you can use to build both the class libraries and
  275.      libraries and  the ObjectWindows libraries. This batch file invokes
  276.        sample code  the makefile in the OWL\SOURCE directory.
  277. ------------------
  278.                     If you installed Borland C++ in a directory other than
  279.                     the default (C:\BORLANDC), you will need to change the
  280.                     macro definition
  281.  
  282.                          BCROOT=c:\borlandc
  283.  
  284.                     in the makefiles to use that other directory.
  285.  
  286.                     The install program installs ObjectWindows, by default,
  287.                     in C:\BORLANDC\OWL. The makefiles are currently set up
  288.                     to assume ObjectWindows was installed in the directory
  289.                     OWL under your Borland C++ directory (the macro
  290.                     BCROOT). You will need to update the OWLROOT macro
  291.                     (which defaults to $(BCROOT)\OWL) in all the makefiles
  292.                     to read:
  293.  
  294.                          OWLROOT=d:\owl
  295.  
  296.                     (or wherever) if you told INSTALL to place
  297.                     ObjectWindows somewhere else.
  298.  
  299.                     These changes are necessary to enable the makefile and
  300.                     the compiler to find the appropriate include files and
  301.                     libraries that are needed to build your ObjectWindows
  302.                     programs. If you do not want to edit the makefile to
  303.                     make this change, you can redefine these on the make
  304.                     command line; for example,
  305.  
  306.                          make -DBCROOT=d:\borlandc -DOWLROOT=d:\owl
  307.  
  308.                     would change the definitions of the BCROOT and OWLROOT
  309.                     make macros to he example programs each have a project
  310.                     file. After you have opened a project in the IDE, you
  311.                     should check the Options|Directories dialog; you may
  312.                     have to change part of the INCLUDE and LIB selections
  313.                     if C:\BORLANDC is not the directory in which you
  314.                     installed Borland C++.
  315.  
  316.                     If you are in a directory containing source or sample
  317.                     code, you can build it by simply running
  318.  
  319.                          make
  320.  
  321.                     To build the programs using the static link libraries
  322.                     for a specific memory model, use
  323.  
  324.                          make -DUSESSTATIC -DMODEL=x
  325.  
  326.                     where x is one of s, m, or l. The makefiles in the
  327.                     OWL\EXAMPLES directory default to small model when the
  328.                     ObjectWindows static libraries are used and to large
  329.                     model when the ObjectWindows DLL is used.
  330.  
  331.                     To build the examples using OWL31.DLL, use
  332.  
  333.                          make -DMODEL=l -DUSEDLL
  334.  
  335.                     or simply,
  336.  
  337.                          make
  338.  
  339.                     (the USEDLL macro is defined by default; if USEDLL is
  340.                     defined, MODEL is defined to be l).
  341.  
  342.                     Note that only large model can be used with
  343.                     ObjectWindows DLLs (including OWL31.DLL).
  344.  
  345.                     To build the code with debug information turned on, use
  346.  
  347.                          make -DDEBUG
  348.  
  349.                     Building with debug information can be very useful. If
  350.                     you have built the libraries with debug info, you will
  351.                     learn a great deal about how the class hierarchy works
  352.                     and interacts if you step through your programs in TDW.
  353.  
  354.                     To build the ObjectWindows DLL (OWL31.DLL), use the
  355.                     following command line in your BORLANDC\OWL\SOURCE
  356.                     directory:
  357.  
  358.                          make -DMODEL=l -DDLL
  359.  
  360.  
  361.                     For faster compilations, we recommend that you use the
  362.                     precompiled headers option. You can add this to a
  363.                     makefile, by adding
  364.  
  365.                          -H
  366.  
  367.                     to the CFLAGS macro in the makefile.
  368.  
  369.    Other important  =======================================================
  370.              notes
  371.                     o You should always use the & and | operators (or &=
  372.                       and |= operators) when modifying Attr.Style for your
  373.                       window objects. Windows relies on certain values to
  374.                       always be present in Attr.Style for certain controls
  375.                       and ObjectWindows will automatically set the proper
  376.                       styles; if you override the values that ObjectWindows
  377.                       puts there, you might be setting an invalid value.
  378.                       For example, the following code is illegal:
  379.  
  380. TMyListBox::TMyListBox(PTWindowsObject AParent, int AnId,
  381.                        int X, int Y, int W, int H, PTModule AModule)
  382.              :TControl(AParent, AnId, NULL, X, Y, W, H, AModule)
  383. {
  384.   Attr.Style = LBS_NOTIFY;
  385. }
  386.  
  387.                       It should be:
  388.  
  389. TMyListBox::TMyListBox(PTWindowsObject AParent, int AnId,
  390.                        int X, int Y, int W, int H, PTModule AModule)
  391.              :TControl(AParent, AnId, NULL, X, Y, W, H, AModule)
  392. {
  393.   Attr.Style |= LBS_NOTIFY;
  394. }
  395.  
  396.                     o Note that correct usage of the transfer mechanism for
  397.                       TComboBox and TListBox differs somewhat from transfer
  398.                       buffer usage for otherwindow objects. The
  399.                       CBXTTEST.CPP and LBXTTEST.CPP example programs
  400.                       demonstrate the correct usage of the transfer
  401.                       mechanism with TComboBoxData and TListBoxData.
  402.  
  403.                     o The TListBox members functions for single-selection
  404.                       list boxes are inherited by TComboBox and can also be
  405.                       used by combo boxes.
  406.