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
jeffs1Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

jeffs1Author Commented:
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
0
DexstarCommented:
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*
0
jeffs1Author Commented:
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
0
JavaScript Best Practices

Save hours in development time and avoid common mistakes by learning the best practices to use for JavaScript.

DexstarCommented:
jeffs1:

Wow, I'm surprised.  I thought for sure that the project preprocessor definitions would carry over to the .rc file as well.  But, I tested it myself and sure enough, it does not.

However, I wouldn't say there is NO way to do it.  I have a few suggestions:

1) Use an include file.  You can include this .h file in you StdAfx.h, and in .rc file via the "Edit -> Resource Includes" command.  Then you can just edit that file to set #defines for everything.

2) VS has a great macro environment.  You can write a quick macro that will copy the project's preprocessor settings to the .rc file's preprocessor settings, and then compiles.  If you want some help with the macro, I can do that...

Dex*
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jeffs1Author Commented:
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
0
DexstarCommented:
Thanks for the info... I had never used that option, so it slipped my mind completely!  :)

Glad you got a solution,
Dex*
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Development

From novice to tech pro — start learning today.