home *** CD-ROM | disk | FTP | other *** search
/ Piper's Pit BBS/FTP: ibm 0040 - 0049 / ibm0040-0049 / ibm0040.tar / ibm0040 / BCPPOWL1.ZIP / OWLDOC.ZIP / HELPME!.DOC < prev    next >
Encoding:
Text File  |  1991-08-28  |  10.0 KB  |  213 lines

  1.           ObjectWindows for C++: ANSWERS TO COMMON QUESTIONS
  2.  
  3.  
  4.  
  5.  B u i l d i n g   O W L   P r o g r a m s
  6.  ----------------------------------------------------------
  7.  
  8.  Q: What compiler options do I build OWL programs with?
  9.  A: You can use -W, -WE, or -WS for OWL applications that do not use DLLs.
  10.     If your OWL application uses DLLs, you must use -WS and you must
  11.     build in large model.  When building a DLL, you may use either
  12.     -WD or -WDE and your DLL must be in large model.
  13.     Note that -WS and -WDE are preferred.  For a good example of a
  14.     makefile that is used to build OWL EXEs and DLLs, look at MAKEFILE
  15.     and MAKEFILE.INC in the OWL\EXAMPLES directory; that directory
  16.     also contains .PRJ project files for building OWL programs that
  17.     use OWL.DLL.
  18.  
  19.  
  20.  Q: What settings should I put in my program's module definition (.DEF)
  21.     file?
  22.  A: You do not need to provide module definition files for your Windows
  23.     programs when they are built with Borland C++.
  24.     If a .DEF file is not present, the linker, TLINK, provides defaults
  25.     (these are documented in the TLINK section of the BC++ User's Guide).
  26.     We do provide a file, OWL.DEF, located in your OWL\LIB subdirectory,
  27.     that provides the same settings as the TLINK defaults.
  28.     If you need to change the default settings, copy this file and make
  29.     your changes in the copy.
  30.  
  31.     Similarly, you do not need to provide a .DEF file for DLLs that you
  32.     write because TLINK provides defaults in that case as well.
  33.     If the default values are not appropriate, you can use the file
  34.     OWLDLL.DEF in OWL\LIB  as a template for your .DEF file.
  35.     Note that this file is different from the file of the same name in
  36.     OWL\SOURCE which is used to build OWL.DLL.
  37.  
  38.  
  39.  Q: Why do I get a linker errors such as "Linker Error: Unable to
  40.     open file 'DLLHELLO.LIB'" when I attempt to build the CALLDLL.EXE or
  41.     the USECDLL.EXE example programs?
  42.  A: The linker error indicates that an import library is not present.
  43.     These programs must be linked with the import libraries of the
  44.     DLLs that they call (DLLHELLO.DLL and CDLGDLL.DLL, respectively).
  45.     The reason for the error is that the import library does not exist
  46.     because the DLL has not yet been built.  Building the DLL using the
  47.     makefile or the associated .PRJ file will result in the import
  48.     library being automatically created for you.
  49.  
  50.  
  51.  Q: When I attempt to build the OWL libraries using the
  52.     BUILDOWL.BAT batch file, my system hangs.  How can I finish
  53.     building the library?
  54.  A: Reboot your machine and run the batch file again.  The
  55.     batch file will run the makefiles again.  The makefile will
  56.     not attempt to rebuild any of the files successfully built during
  57.     the first run of the batch file.  This problem may occur while
  58.     processing WINDOBJ.CPP or SWINDOBJ.CPP.  Note that the file will
  59.     be correctly compiled and assembled; the hang occurs after the
  60.     assembly is complete.
  61.  
  62.  
  63.  
  64.  D e b u g g i n g   O W L   P r o g r a m s
  65.  ----------------------------------------------------------------------
  66.  
  67.  Q. In TDW, why do I get an exception 13 error when I trace (F7) through
  68.     a constructor for a class derived from TApplication when no error
  69.     is reported if the program is run outside of TDW?
  70.  A. There is currently a bug in TDW which results in stack corruption
  71.     when an attempt is made to trace (F7) through certain inline
  72.     constructors.  The stack corruption usually results in a General
  73.     Protection (GP) fault somewhere down the line.
  74.  
  75.     A workaround is as follows: If you would like to trace into a
  76.     constructor call and notice (in the Module Viewer) that the
  77.     constructor is inline (its definition is within the body of a class
  78.     definition or it is declared with an explicit "inline" keyword),
  79.     temporarily switch into the cpu viewer (View:CPU) and trace (F7)
  80.     until you get to the first CALL instruction.  Type F7 again, to trace
  81.     into the call, and then switch back to the Module viewer (by typing
  82.     Control-V).  You will be returned to the source for the first
  83.     non-inline function.  From there you may continue to trace normally.
  84.  
  85.     Note that not all inline constructors exhibit this problem.  One in
  86.     particular which almost always causes the GP fault is the
  87.     TApplication constructor.
  88.  
  89.  
  90.  Q. Why do I get an Error message box when I run my program?
  91.  A. The message box will appear if an error occurred during the
  92.     creation of a Window element.  This may indicate that you are
  93.     low in memory.  Very often this message appears when you attempt
  94.     to create an element that depends on information in your resource
  95.     template script (.RC) file and the identifier for it in your
  96.     source code does not have a matching item in the .RC file;
  97.     be wary of typographical errors.
  98.  
  99.  
  100.  Q. Why do I get an Unrecoverable Application Error when I run my program?
  101.  A. Typically, this error is reported when memory is used incorrectly.
  102.     You may be using a pointer containing an invalid address.
  103.  
  104.     You may be using an invalid window handle; for example, you
  105.     attempt to send a message to a window before it has been
  106.     created or after it has been destroyed.  Remember that,
  107.     when you construct a (C++) object representing a (Windows) element,
  108.     the element does not yet exist.  You initialize the window object
  109.     in the constructor but you should not try to initialize the window
  110.     element until the call to SetupWindow (or, on rare occasions,
  111.     near the end of Create).
  112.  
  113.     Another place where errors are made is in the creation and
  114.     execution of modal dialog boxes.  You first create the dialog object
  115.     using 'new', and then execute it using the ExecDialog member function
  116.     of your application object, as in the following:
  117.  
  118.         TDialog *MyDialog = new TDialog(this, "DialogName");
  119.         GetApplication()->ExecDialog(MyDialog);
  120.  
  121.     'ExecDialog' invokes the objects 'Execute' member function but
  122.     first calls 'ValidWindow'.  Always create window objects (including
  123.     dialog and control objects) with 'new' (ie, from the heap)
  124.     because 'delete' is called on the window object pointer when
  125.     the corresponding window element is destroyed.
  126.  
  127.  
  128.  
  129.  R u n n i n g   O W L   P r o g r a m s
  130.  ----------------------------------------------------------------------
  131.  
  132.  Q. Why do I get error dialog boxes from Windows when I attempt to run
  133.     my program?
  134.  A. If you built your program to use a DLL, then that DLL must be located
  135.     in the same directory as the EXE that uses it, in the Windows directory,
  136.     in the Windows system directory, or in a directory in your path.
  137.     If this is not the case, Windows will put up a message
  138.     indicating that it cannot find the DLL.  By default, OWL.DLL,
  139.     BWCC.DLL and BCRTL.DLL are placed into your BORLANDC\BIN directory
  140.     by the INSTALL program.
  141.  
  142.     Also, take care that you are using the correct versions of DLLs
  143.     required by your EXEs.  If you modify and rebuild a DLL, make sure
  144.     that the new DLL is in your path and found before any older versions
  145.     of the DLL on your search path; your application may crash doing
  146.     otherwise correct code if an older version of your DLL is in your
  147.     path and found before a new version.
  148.  
  149.  
  150.  Q. Why do I get a message saying "Error: Cannot establish DDE link to
  151.     DDE server" when I attempt to run the PROGTALK example program?
  152.  A. If you started this program from the DOS command line by typing
  153.     "win progtalk", then you will get this message.  This example
  154.     program attempts to use the program manager as its DDE server.
  155.     When the program is invoked via "win progtalk", Windows loads
  156.     PROGTALK before PROGMAN, and the DDE initialization fails.
  157.  
  158.  
  159.  Q. Why can't I run more than one instance of the INSTTEST example
  160.     program
  161.  A. This will happen if you built INSTTEST in large model.  Windows
  162.     does not allow you to run more than one instance of a program
  163.     that has more than one data segment.
  164.  
  165.  
  166.  
  167.  O t h e r    Q u e s t i o n s
  168.  ----------------------------------------------------------------------
  169.  
  170.  Q. What is the difference between a child window in ObjectWindows and
  171.     a WS_CHILD window?
  172.  A. In Windows, WS_CHILD is a style for a window that is confined to
  173.     the client area of a parent window.
  174.  
  175.     This child-parent relationship is not the same as the child-parent
  176.     model used to describe relationships between windows in ObjectWindows
  177.     (though there are conceptual similarities).
  178.  
  179.     In ObjectWindows, a child window is an interface element that is
  180.     managed by another interface element.  A child window is displayed
  181.     only when its parent window is displayed.  For example, a dialog
  182.     box is a child window managed by the window that spawned it.
  183.  
  184.     When you close its parent window, the child window automatically closes.
  185.     An ObjectWindows child window MAY have a WS_CHILD style, though
  186.     it is not required to be.
  187.  
  188.     For more information on the child-parent relationship in
  189.     ObjectWindows, see the ObjectWindows Programmer's Guide.  For
  190.     more information on the WS_CHILD window style and (Windows) child
  191.     windows, see the MS Windows
  192.     Programmer's Reference.
  193.  
  194.  
  195.  Q. If I am porting a program from ObjectWindows for Pascal (OWLP) to
  196.     ObjectWindows for C++ (OWLC), what are the differences that I
  197.     will need to know?
  198.  A. The object hierarchies for OWLP and OWLC are similar but you
  199.     will want to note the following differences:
  200.  
  201.     - The 'TMDIFrame' class in OWLC corresponds to the 'TMDIWindow'
  202.     object in OWLP.
  203.  
  204.     - The 'TMDIClient' object in OWLP is derived from 'TControl'.
  205.     The 'TMDIClient class in OWLC is derived from 'TWindow'.
  206.  
  207.     - The 'TDlgWindow' object in OWLP does not have a corresponding
  208.     class in OWLC.  However, all of its functionality is contained
  209.     within TDialog.  If you are porting an OWLP application to OWLC,
  210.     interpret all references to 'TDlgWindow' as 'TDialog'.  For an
  211.     example of how to use a dialog as a main window, check out
  212.     CALC.CPP in the OWL\EXAMPLES\CALC subdirectory.
  213.