Menu

Convert_Borland_C++_resource_files_to_Visual_C++

Converting Borland C++ Resource Files to Visual C++

The Borland and Microsoft resource file formats differ in two important ways:

  1. The Borland format accepts embedded bitmaps, i.e. the inlining of an encoded stream that defines the bitmap data.
  2. In the Borland format, resource identifiers can be integral expressions.

The Microsoft format does not support these features. See Resource Compiler in the MSDN Library for the details of the Microsoft resource file syntax.


Embedded bitmaps

A key difference between the Borland and Microsoft resource script (RC) formats is that the Borland format allows bitmaps, cursors and icons to be embedded within the file, encoded as a hexadecimal stream, whereas in the Microsoft format the script references external files in which the bitmaps must reside.

For example, an icon may be in-lined in a Borland resource script as follows:

 IDI_TUTORIAL ICON 
 {
   '00 00 01 00 01 00 20 20 10 00 00 00 00 00 E8 02'
   '00 00 16 00 00 00 28 00 00 00 20 00 00 00 40 00'
   ...
   '00 FF FF 80 01 FF FF C0 03 FF FF E0 07 FF FF F8'
   '1F FF FF FF FF FF FF FF FF FF FF FF FF FF'
 }

The same icon will be represented by an external reference in the Microsoft format:

 IDI_TUTORIAL ICON "tutorial.ico"


Using OWLMaker to extract bitmaps

A function for extracting in-lined bitmaps from Borland RC files is incorporated in OWLMaker. For more information see the OWLMaker documentation.


RCConvertor

RCConvertor is a command-line tool written by Boris Vidolov that performs bitmap extraction. This command tool has been superseded by the built-in function in OWLMaker, hence we now recommend that OWLMaker is used for resource file conversion.


Integral expressions as identifiers

Another difference in the Borland and Microsoft formats, and the one that may demand most work to convert, is that the Microsoft resource format does not allow an arithmetic expression as the identifier for a resource. For example, the following ID definition will not work:

 #define IDD_MYDIALOG (IDD_BASE + 1)
 IDD_MYDIALOG DIALOG ...
 BEGIN
     ...
 END

The resource ID needs to be converted to either a number or a string. For example,

 #define IDD_MYDIALOG 1001
 IDD_MYDIALOG DIALOG ...
 BEGIN
     ...
 END

Note that this does not apply to control or string identifiers within a resource (IDC_*; IDS_*). Here an arithmetic expression is allowed. For example, this works fine:

 #define IDC_INPUT (IDC_BASE + 1)
 IDD_MYDIALOG DIALOG ...
 BEGIN
     EDITTEXT     IDC_INPUT, ...
     ...
 END

 #define IDS_PROMPT (IDS_BASE + 1)
 STRINGTABLE
 BEGIN
     IDS_PROMPT   "Hello"
 END



Related

Discussion: Which editor for gui design
Wiki: Knowledge_Base
Wiki: Migrating_from_BC_to_VC
Wiki: OWLMaker
Wiki: OWLMaker_3175
Wiki: Supported_Compilers
Wiki: Upgrading_from_OWL

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.