In BC++ was free to control the layout and content of the .rc files, and when using the resource editor, only the things that I specifically changed in the editor got changed in the resource file. Much to my dismay, the VC++ resource editor will completely rewrite your .rc file, and possibly destroy or ignore any changes that you personally make.
This was terribly frustrating at first, but I basically learned to deal with it and it's not SO bad after a while, since in general I don't write any amount of my resources by hand, but reserve that for minor changes that perhaps I can't quite accomplish in the editor.
project_name.rh
. However by default in VC++ this header is ALWAYS called resource.h
,
so for simplicity I've adopted this for the current tutorial revision, as it doesn't impact BC++ at all.
For the curious, it is possible to change the name of the resource that VC++ uses by editing the .rc file manually
and changing the name in two places, once where it is #include
d, and second where it is contained in a
TEXTINCLUDE
resource.
The next problem is that by default VC++ requires the file afxres.h
to be included in it's .rc files,
whereas BC++ has all the necessary preprocessor macros defined automatically and requires no such include. Another
dumb thing about this is that afxres.h
is only installed when you insall MFC which not everyone does,
even when you are creating an API application which only requires winres.h
which is always installed.
Since I work in VC++ and use it's resource editor I've solved this problem by slightly altering each .rc file that is generated to include the following:
#ifndef __BORLANDC__ #include "winres.h" #endifWhich under default circumstances would usually read:
#include "afxres.h"For those of you that are using VC++ you can find the option to change this text within the IDE under "View > Resource Includes". There is generally no need to ever use this in normal practice, it's simply a way I used to work around the problem of making things work with BC++ and VC++.
To those of you using BC++, I'm sorry about the extra mess in the .rc files that are generate by the VC++ editor, but it shouldn't interfere with anything.