Ray,
RG>I have just started to use Borland c++ and have a problem
RG>with the first OWL programs that I have tried. I entered
RG>the programs from "Teach yourself Borland C++ 4 in 21
RG>Days". Instead of entering the .rc files from the book I
RG>used the Resource Workshop to create them. The first
RG>program ran but did not display the menu created in RW. On
RG>examing the .rh file produced by RW there was the line
RG> #define MAINMENU 1
RG>I removed this line, recompiled the program and it worked???
RG>
RG>The second program I entered was to display a dialog box.
RG>Again I used the Resource Workshop to produce the dialog.
RG>The program crashed with a GPF. On checking the .rh file
RG>there was a line
RG> #define DIALOG1 1
RG>I removed this line and recompiled the program. It worked.
RG>
RG>I'm sure I must be doing something wrong either in the C++
RG>code or in the Resource Workshop. As I am new to C++ I'm
RG>not sure where to look. Can any one help???
That one took me several months to figure out... There seems to be a
slight bug (undocumented feature?) with the resource compiler and I found
by reading and reading several after market books (it's not in Borlands
documentation, at least not that I could find at the time) that it is
necessary to ensure that the following lines are placed in the RC file.
#ifdef RC_INVOKED //Place at the beginning of file
// Other lines of resource code
#endif // Place at the end of the file
Note: If you add more resources to the file, more stuff on the menu,
another dialog box, etc. You MUST manually move the "#endif" to the end
of the file listing or you will have problems similar to what you describe.
BTW, Unless you have the resources defined elsewhere in the code,
you should NOT remove the define lines from the RH file. If problems
persist, I would take another look at how you are calling your
functions. (Maybe you could post a short snippet) If your program's
causing a GPF, I would suspect that the problem is not going to be in the
necessary declaration of a resource.
Later, Pat Glenn
___
* UniQWK v4.2 * The Windows Mail Reader
--- Maximus 3.01
---------------
* Origin: C+Net BBS. Programming & Networking. (1:342/601)
|