[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Resource file conversion

Posted on 2003-11-07
6
Medium Priority
?
470 Views
Last Modified: 2013-12-03
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
0
Comment
Question by:jeffs1
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 

Author Comment

by:jeffs1
ID: 9718355
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
 
LVL 19

Expert Comment

by:Dexstar
ID: 9736169
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
 

Author Comment

by:jeffs1
ID: 9739254
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
Learn Veeam advantages over legacy backup

Every day, more and more legacy backup customers switch to Veeam. Technologies designed for the client-server era cannot restore any IT service running in the hybrid cloud within seconds. Learn top Veeam advantages over legacy backup and get Veeam for the price of your renewal

 
LVL 19

Accepted Solution

by:
Dexstar earned 1600 total points
ID: 9740944
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
 

Author Comment

by:jeffs1
ID: 9757678
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
 
LVL 19

Expert Comment

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

Glad you got a solution,
Dex*
0

Featured Post

 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

zlib is a free compression library (a DLL) on which the popular gzip utility is built.  In this article, we'll see how to use the zlib functions to compress and decompress data in memory; that is, without needing to use a temporary file.  We'll be c…
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question