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

  1. ===========================================================================
  2. ObjectWindows for C++
  3. ANSWERS TO COMMON QUESTIONS
  4. ===========================================================================
  5.  
  6.       Building OWL  =======================================================
  7.           programs
  8.                     Q: What compiler options do I build OWL programs with?
  9.                     A: For OWL applications that do not use DLLs, you can
  10.                        use the "Windows all functions exportable", "Windows
  11.                        explicit functions exported", or "Windows smart
  12.                        callbacks" options in the Options|Compiler|
  13.                        Entry/Exit code dialog box (these correspond to the
  14.                        -W, -WE, and -WS command line options of BCC,
  15.                        respectively). If your OWL application uses DLLs,
  16.                        you must use smart callbacks and you must build in
  17.                        large model. When building a DLL, you may use either
  18.                        "Windows DLL all functions exportable" or "Windows
  19.                        DLL explicit functions exported" (which correspond
  20.                        to -WD or -WDE, respectively) and your DLL must be
  21.                        in large model. Note that "smart callbacks" and "DLL
  22.                        explicit functions exported" are preferred. The
  23.                        OWL\EXAMPLES directory contains .PRJ project files
  24.                        for building OWL programs; eg, CHECKERS.PRJ uses
  25.                        OWL31.DLL, DLLHELLO.PRJ builds an OWL DLL, and
  26.                        CALLDLL.PRJ builds a program that uses DLLHELLO.DLL.
  27.  
  28.                        Also, if you intend your program to use OWL31.DLL
  29.                        (ie, you link with the OWL.LIB import library), you
  30.                        must define the _CLASSDLL macro when you compile;
  31.                        you do this by adding "_CLASSDLL" in the "Defines"
  32.                        text box in the Options|Compiler|Code Generation
  33.                        dialog box in the IDE (or with the -D command-line
  34.                        option). This definition ensures that all classes
  35.                        are 'huge' (far 'this' and far vtable pointers). A
  36.                        common error is to fail to provide the _CLASSDLL
  37.                        definition when you link with OWL.LIB; this will
  38.                        result in linker errors saying 'undefined symbol'
  39.                        for many OWL functions.
  40.  
  41.  
  42.                     Q: What settings should I put in my program's module
  43.                        definition (.DEF) file?
  44.                     A: You do not need to provide module definition files
  45.                        for your Windows programs when they are built with
  46.                        Borland C++. If a .DEF file is not present, the
  47.                        linker provides reasonable defaults. We do provide a
  48.  
  49.  
  50.  
  51.                                                                           1
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.                        file, OWL.DEF, located in your OWL\LIB subdirectory,
  59.                        that provides the same settings as the TLINK
  60.                        defaults. If you need to change the default
  61.                        settings, copy this file and make your changes in
  62.                        the copy.
  63.  
  64.                        Similarly, you do not need to provide a .DEF file
  65.                        for DLLs that you write because the linker provides
  66.                        defaults in that case as well. If the default values
  67.                        are not appropriate, you can use the file OWLDLL.DEF
  68.                        in OWL\LIB as a template for your .DEF file. Note
  69.                        that this file is different from the file of the
  70.                        same name in OWL\SOURCE which is used to build
  71.                        OWL31.DLL.
  72.  
  73.  
  74.                     Q: Why do I get a linker errors such as "Linker Error:
  75.                        Unable to open file 'DLLHELLO.LIB'" when I attempt
  76.                        to build the CALLDLL.EXE or the USECDLL.EXE example
  77.                        programs?
  78.                     A: The linker error indicates that an import library is
  79.                        not present. These programs must be linked with the
  80.                        import libraries of the DLLs that they call
  81.                        (DLLHELLO.DLL and CDLGDLL.DLL, respectively). The
  82.                        reason for the error is that the import library does
  83.                        not exist because the DLL has not yet been built.
  84.                        Building the DLL using the makefile or the
  85.                        associated .PRJ file will result in the import
  86.                        library being automatically created for you.
  87.  
  88.  
  89.      Debugging OWL  =======================================================
  90.           programs
  91.                     Q. Why do I get an Error message box when I run my
  92.                        program?
  93.                     A. The message box will appear if an error occurred
  94.                        during the creation of a Window element. This may
  95.                        indicate that you are low in memory. Very often this
  96.                        message appears when you attempt to create an
  97.                        element that depends on information in your resource
  98.                        template script (.RC) file and the identifier for it
  99.                        in your source code does not have a matching item in
  100.                        the .RC file; be wary of typographical errors.
  101.  
  102.  
  103.                     Q. Why do I get an Unrecoverable Application Error when
  104.                        I run my program?
  105.  
  106.  
  107.  
  108.  
  109. 2                                               Online Document HELPME!.DOC
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.                     A. Typically, this error is reported when memory is
  117.                        used incorrectly. You may be using a pointer
  118.                        containing an invalid address.
  119.  
  120.                        You may be using an invalid window handle; for
  121.                        example, you attempt to send a message to a window
  122.                        before it has been created or after it has been
  123.                        destroyed. Remember that, when you construct a (C++)
  124.                        object representing a (Windows) element, the element
  125.                        does not yet exist. You initialize the window object
  126.                        in the constructor but you should not try to
  127.                        initialize the window element until the call to
  128.                        SetupWindow (or, on rare occasions, near the end of
  129.                        Create).
  130.  
  131.                        Another place where errors are made is in the
  132.                        creation and execution of modal dialog boxes. You
  133.                        first create the dialog object using 'new', and then
  134.                        execute it using the ExecDialog member function of
  135.                        your application object, as in the following:
  136.  
  137.                           TDialog *MyDialog = new TDialog(this,
  138.                                                           "DialogName");
  139.                           GetApplication()->ExecDialog(MyDialog);
  140.  
  141.                        'ExecDialog' invokes the object's 'Execute' member
  142.                        function but first calls 'ValidWindow'. Always
  143.                        create window objects (including dialog and control
  144.                        objects) with 'new' (ie, from the heap) because
  145.                        'delete' is called on the window object pointer when
  146.                        the corresponding window element is destroyed.
  147.  
  148.  
  149.        Running OWL  =======================================================
  150.           programs
  151.                     Q. Why do I get error dialog boxes from Windows when I
  152.                        attempt to run my program?
  153.                     A. If you built your program to use a DLL, then that
  154.                        DLL must be located in the same directory as the EXE
  155.                        that uses it, in the Windows directory, in the
  156.                        Windows system directory, or in a directory in your
  157.                        path. If this is not the case, Windows will put up a
  158.                        message indicating that it cannot find the DLL. By
  159.                        default, OWL31.DLL, TCLASS31.DLL, and BC30RTL.DLL
  160.                        are placed into your BORLANDC\BIN directory by the
  161.                        INSTALL program; unless you specify otherwise,
  162.                        BWCC.DLL will be placed into your WINDOWS\SYSTEM
  163.                        directory.
  164.  
  165.  
  166.  
  167.                                                                           3
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.                        Also, take care that you are using the correct
  175.                        versions of DLLs required by your EXEs. If you
  176.                        modify and rebuild a DLL, make sure that the new DLL
  177.                        is in your path and found before any older versions
  178.                        of the DLL on your search path; your application may
  179.                        crash doing otherwise correct code if an older
  180.                        version of your DLL is in your path and found before
  181.                        a new version.
  182.  
  183.  
  184.                     Q. Why do I get a message saying "Error: Cannot
  185.                        establish DDE link to DDE server" when I attempt to
  186.                        run the PROGTALK example program?
  187.                     A. If you started this program from the DOS command
  188.                        line by typing "win progtalk", then you will get
  189.                        this message. This example program attempts to use
  190.                        the program manager as its DDE server. When the
  191.                        program is invoked via "win progtalk", Windows loads
  192.                        PROGTALK before PROGMAN, and the DDE initialization
  193.                        fails.
  194.  
  195.  
  196.    Other questions  =======================================================
  197.  
  198.                     Q. What is the difference between a child window in
  199.                        ObjectWindows and a WS_CHILD window?
  200.                     A. In Windows, WS_CHILD is a style for a window that is
  201.                        confined to the client area of a parent window.
  202.  
  203.                        This child-parent relationship is not the same as
  204.                        the child-parent model used to describe
  205.                        relationships between windows in ObjectWindows
  206.                        (though there are conceptual similarities).
  207.  
  208.                        In ObjectWindows, a child window is an interface
  209.                        element that is managed by another interface
  210.                        element. A child window is displayed only when its
  211.                        parent window is displayed. For example, a dialog
  212.                        box is a child window managed by the window that
  213.                        spawned it. When you close its parent window, the
  214.                        child window automatically closes.
  215.  
  216.                        An ObjectWindows child window MAY have a WS_CHILD
  217.                        style, though it is not required to be.
  218.  
  219.                        For more information on the child-parent
  220.                        relationship in ObjectWindows, see the ObjectWindows
  221.                        User's Guide. For more information on the WS_CHILD
  222.  
  223.  
  224.  
  225. 4                                               Online Document HELPME!.DOC
  226.  
  227.  
  228.  
  229.  
  230.  
  231.  
  232.                        window style and (Windows) child windows, see the
  233.                        Microsoft Windows Programmer's Reference.
  234.  
  235.  
  236.                     Q. If I am porting a program from ObjectWindows for
  237.                        Pascal (OWLP) to ObjectWindows for C++ (OWLC), what
  238.                        are the differences that I will need to know?
  239.  
  240.                     A. The object hierarchies for OWLP and OWLC are similar
  241.                        but you will want to note the following differences:
  242.  
  243.                     o The 'TMDIFrame' class in OWLC corresponds to the
  244.                       'TMDIWindow' object in OWLP.
  245.  
  246.                     o The 'TMDIClient' object in OWLP is derived from
  247.                       'TControl' while the 'TMDIClient' class in OWLC is
  248.                       derived from 'TWindow'.
  249.  
  250.                     o The 'TDlgWindow' object in OWLP does not have a
  251.                       corresponding class in OWLC. However, all of its
  252.                       functionality is contained within TDialog. If you are
  253.                       porting an OWLP application to OWLC, interpret all
  254.                       references to 'TDlgWindow' as 'TDialog'. For an
  255.                       example of how to use a dialog as a main window,
  256.                       check out CALC.CPP in the OWL\EXAMPLES\CALC
  257.                       subdirectory.
  258.  
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.  
  269.  
  270.  
  271.  
  272.  
  273.  
  274.  
  275.  
  276.  
  277.  
  278.  
  279.  
  280.  
  281.  
  282.  
  283.                                                                           5
  284.  
  285.