Link to home
Start Free TrialLog in
Avatar of jeffs1
jeffs1

asked on

Resource file conversion

I have an old Borland C++ project I am converting to Visual C++ 7 (Visual Studio .NET 2003).  I notice that the resource file format that Borland uses is different than the Microsoft format... and some things do not transfer properly...

1) Borland static text controls (using the CONTROL keyword) can be any length, but MS throws a compile error is they are > 256 characters.  If I create a new static text control in MSVS it uses an LTEXT keyword... and this seems to support larger test strings properly.
2) Borland allowed escape characters (\") in static test controls... MS does not recognize this and generates an error.

Is there any way, short of redoing over 100 complex dialogs by hand (not an option) that I can convert a borland resource file to use the current Microsoft format automatically?

Anyone have a good source of documentation for resource files in general?  I have not been able to find ANYTHING on the borland format or the MS format...

Any light that you could shed on this for me would be greatly appreciated.

Jeff
Avatar of jeffs1
jeffs1

ASKER

OK.. An update... I figured out how to get VStudio to update the .rc file to MS format... and also that the \n is replaced by "" in MS speak.  Two outstanding issues remain...

1) Any way around the apparent control text lilmit of 256 characters in MS .rc file?  All tags, CONTROL, LTEXT, EDITTEXT, etc. have the same limit... they all truncate at 256 characters... I have a bunch of larger static text controls that I will have to set programatically if there is no work around in the resource file itself.

2) Under Borland, global IDE project setting #defines are sent to both the C++ compiler and the resource compiler... I use these to conditionally compile in certain resources depending on the version of the exe I am building... under Visual Studio, it seems there are two separate project define settings... one for the C++ compiler and one for the resource compiler... I do not want to have to remember to adjust values in two places when I do a build (just asking for errors)... and I do not want to have to define a new build type, since it will complicate the settings that I change for ALL configs.  I need to have the IDE defined C++ compiler defines active in the resource compilation.  Any way to do this?

Thanks,
Jeff
jeffs1:

> 1) Any way around the apparent control text lilmit of 256 characters in MS
> .rc file?  All tags, CONTROL, LTEXT, EDITTEXT, etc. have the same limit...
> they all truncate at 256 characters... I have a bunch of larger static text
> controls that I will have to set programatically if there is no work around
> in the resource file itself.

I don't think there is a way to do that.  You may just have to use 2 controls where you used to be able to use 1.

> 2) Under Borland, global IDE project setting #defines are sent to both the
> C++ compiler and the resource compiler... I use these to conditionally compile
> in certain resources depending on the version of the exe I am building...
> under Visual Studio, it seems there are two separate project define settings...
> one for the C++ compiler and one for the resource compiler...
> Any way to do this?

In the properties of the resource, set the "condition" to be the #define that you want to use to indicate to include that resource, and then set that #define in the Preprocessor settings of your project.

I frequently set the condition property of an icon or an image to be "_DEBUG" and then add another one with the same ID, etc., that points to a different file with a condition of NDEBUG., so I can provide different images for the debug version of my project.

Hope that helps,
Dex*
Avatar of jeffs1

ASKER

Thanks, Dex... You are correct that that will work... but my problem is that the DEFINES project settings are different for the C++ preprocessor and the Resource compiler.  I want to be able to set a global define in ONE place and have that control my C++ build and the resource build.  If I have to always rememebr to set it in two places I am just asking for trouble... in Borland, the project defines applied to the C++ preprocessor AND the resource compiler.  In VC++ they are separate...

I have looked at using the predefined macros... they provide a ProjectBuildConfig macro which is either Release or Debug, but no SolutionConfig macro...

There seems to be NO way to control the entire build of my app with a single define, defined in a single location, that controls both teh C++ preprocessor and the Resource compiler.

Jeff
ASKER CERTIFIED SOLUTION
Avatar of Dexstar
Dexstar

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jeffs1

ASKER

Dex,

Thanks for the recommendations... I think I will go with the include file method... that should do the job... the IDE compiler define settings are a bit clunky anyway... and I have not found a way to make the properties dialog default to "All configs" instead of the active config... I cannot tell you how many times I have made a change to the active config when I intended it for both Debug and release configs because I forgot to select the "All configs".

Looks like using the "C/C++, Advanced, Force Includes" setting will guaranteer the include file be included for every line of every C++/h files processed without having to include it separately in each file.

Thanks for your suggestions and help.

Jeff
Thanks for the info... I had never used that option, so it slipped my mind completely!  :)

Glad you got a solution,
Dex*