Click here to Skip to main content
13,291,084 members (72,340 online)
Click here to Skip to main content
Add your own
alternative version


47 bookmarked
Posted 11 Feb 2003

Auto Windows Resource (*.rc) version Editor

, 23 Jun 2003
Rate this:
Please Sign up or sign in to vote.
This freeware allows to edit a Windows Resources File (*.rc) and to produce a file named 'version.h' containing several string constants (#define). It can also synchronize a RC file and version.h with the Classbuilder Master Header File.

Sample Image - rcversion_snapsho.png


This freeware is inspired by a tool by Srinivas Vaithianathan hosted by CodeProject too: Versioning of executables at build time. I completely modified it and now there isn't any code remaining from it.

Since several years now, I'm using a great open source tool named ClassBuilder. This tool is provided by Jimmy Venema and can be found at SourceForge.

From Sourceforge project page:

ClassBuilder is a freeware CASE tool targeted at the C++ developer, running on Win95/98/NT. It lets you create, manipulate and navigate classes, class relations, class members and class methods at a high level of abstraction through a graphical user interface.

ClassBuilder generates two files for each class (one *.cpp and one *.h) and a Master Header File for the whole data model. The Master Header File includes all the classes' headers, defines the typedefs,... This file also contains some symbolic constants which are automatically updated when you generate the sources. According to a data model named model, the Master Header File model.h will contain:

#define MODEL_DATE      20030211
#define MODEL_TIME      193311
#define MODEL_VERSION   12

Each time you change the interface, ClassBuilder increments MODEL_VERSION and updates MODEL_DATE and MODEL_TIME.

Compiling the data model as executable or DLL

To use the data model, you should compile it as a static lib, an executable or a DLL. In case of exe or DLL, the Visual Studio generates a *.rc file. This file contains GUI definitions, icons, cursors, bitmaps... It should also contain the version information of the binary.

Here is the fragment of code in a Windows Resource File which describes the version information for RCVersion itself.

// Version

FILEVERSION 1, 0, 0, 100
#ifdef _DEBUG
    BLOCK "StringFileInfo"
        BLOCK "040904b0"
            VALUE "Comments", "Modified by BZCToOn's"
            VALUE "CompanyName", "Syntheretix"
            VALUE "FileDescription", "rcversion MFC Application"
            VALUE "FileVersion", "1, 0, 0, 100"
            VALUE "InternalName", "rcversion"
            VALUE "LegalCopyright", "Copyleft (C) Bzc ToOn'S 2002"
            VALUE "OriginalFilename", "rcversion.EXE"
            VALUE "PrivateBuild", "RCVERSION-20030212_100"
            VALUE "ProductName", "rcversion Application"
            VALUE "ProductVersion", "1, 0, 0, 1"
    BLOCK "VarFileInfo"
        VALUE "Translation", 0x409, 1200

What RCVersion does?

RCVersion parses both the Master Header File and the Resources File. Next, according to the information contained in these two files, it generates a file named version.h and updates the Resources File.

Output: version.h

Here is the output file produced by RCVersion for itself.

// Generated by RCVersion build RCVERSION-20030212_100 (20030213-020245)
// Copyleft (C) Bzc ToOn'S 2002
// Generated on 13/02/2003 02:02:46 from resource file rcversion.rc
#define __SNAPSHOT__        "20030213-020246"
#define __FILEVERSION__     ""
#define __PRODUCTVERSION__  ""
#define __COMPANY__         "Syntheretix"
#define __PRODUCT__         "rcversion Application"
#define __DESCRIPTION__     "rcversion MFC Application"
#define __PRIVATEBUILD__    "RCVERSION-20030212_100"
#define __COPYRIGHT__       "Copyleft (C) Bzc ToOn'S 2002"

// Master Header Values (ClassBuilder)!!
#define __CB_DATE__         "20030212"
#define __CB_TIME__         "190244"
#define __CB_VERSION__      "100"

// Do Not Modify !!

Command line execution

rcversion [-q] [-i input]
  -q   quiet: don't show the UI. Usefull for Custom Build Step in Visual Studio.
  -i   input: specify the input file. The input file could be *.rc or *.h.
              The filename without extension will be used as data model name.

How to use RCVersion with Visual Studio

  1. Add a file to the project: version.h
  2. Define Custom Build Step
    • Command Line: rcversion -q -i $(TargetName)
    • Description: RCVersion
    • Output: version.h
    • Dependencies: $(TargetName).h
  3. You can now put #include 'version.h' in $(TargetName).h or in stdafx.h.

Don't forget to put RCVERSION in path


To set Visual Studio executable path to the directory where RCVERSION is installed


  • Version number extraction from Classbuilder Master Header File
  • RC File version information editor
  • version.h generation
  • Optional RC file update
  • Backup of your old version.h and RC files
  • Preview of version.h and RC files
  • Edition of version.h and RC files (through Notepad :-))
  • Non interactive execution

Bugs & limitation

I only tested RCVersion on my own projects. For me, it runs fine. I hope for you too ;-).


  • RCVERSION-20030212_100
    • First release
  • RCVERSION-20030214_200
    • version.h: Added #ifdef _DEBUG / #endif
    • version.h: better formatting
    • Added new field 'Symbols Prefix' to the symbolic constants
    • Added new command line option -p prefix to set the symbols prefix
    • Preview control is now a RichEdit one to support fixed width font

Fixed Bugs

  • RC File parsing: If a control ID contains one of the VERSIONINFO directive (FILEVERSION, PRODUCTVERSION), the whole line is replaced and the whole RC File is corrupted.


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Web Developer
France France
I started programming when I was 12 years old. Since I learned some computer languages (C/C++, Perl, PHP, ASM(Z80, 68000, x86), UML ,SQL,...), some API (FLTK, QT, wxWindows, Win32, Direct3D, OpenGL and now MFC...).
Next, I worked as Web Programmer, as Network & Systems Admin (Scientific Calculators, Virtual Reality System, Solaris, SGI, W9X/NT/2K/XP,....).
Now I'm Computer Consultant from Network & Systems Administration and specific developments (PHP/MYSQL, Perl, C/C++/MFC,)

You may also be interested in...


Comments and Discussions

Question"Get latest version" link links back to CodeProject Pin
Member 1232258811-Feb-16 22:24
memberMember 1232258811-Feb-16 22:24 
GeneralProject missing Pin
anubis_ex4-Oct-07 7:01
memberanubis_ex4-Oct-07 7:01 
GeneralOne small bug Pin
ambarish_guntun14-Sep-04 2:33
memberambarish_guntun14-Sep-04 2:33 
GeneralPre-Build Event instead of Custom Build Step Pin
RichieB2B9-Jun-03 9:53
memberRichieB2B9-Jun-03 9:53 
GeneralRe: Pre-Build Event instead of Custom Build Step Pin
Réda BOUREBABA9-Jun-03 12:39
memberRéda BOUREBABA9-Jun-03 12:39 
GeneralRe: Pre-Build Event instead of Custom Build Step Pin
RichieB2B10-Jun-03 0:08
memberRichieB2B10-Jun-03 0:08 
GeneralRe: Pre-Build Event instead of Custom Build Step Pin
Réda BOUREBABA10-Jun-03 11:25
memberRéda BOUREBABA10-Jun-03 11:25 
Generalrcversion.rc2 and rcversion.ico missing Pin
RichieB2B9-Jun-03 9:45
memberRichieB2B9-Jun-03 9:45 
QuestionHow compile in Visual C++ 6 Pin
Piccinano13-Feb-03 0:40
memberPiccinano13-Feb-03 0:40 
AnswerRe: How compile in Visual C++ 6 Pin
Réda BOUREBABA13-Feb-03 3:09
memberRéda BOUREBABA13-Feb-03 3:09 
General__SYMBOL__ Pin
Dalle12-Feb-03 22:09
memberDalle12-Feb-03 22:09 
GeneralRe: __SYMBOL__ Pin
Réda BOUREBABA13-Feb-03 3:14
memberRéda BOUREBABA13-Feb-03 3:14 
GeneralRe: __SYMBOL__ Pin
Dalle13-Feb-03 4:38
memberDalle13-Feb-03 4:38 
GeneralRe: __SYMBOL__ Pin
Michael Dunn13-Feb-03 20:14
sitebuilderMichael Dunn13-Feb-03 20:14 
GeneralRe: __SYMBOL__ Pin
Réda BOUREBABA14-Feb-03 2:23
memberRéda BOUREBABA14-Feb-03 2:23 
That's done !! Big Grin | :-D Please take a look to the latest release....

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.171207.1 | Last Updated 24 Jun 2003
Article Copyright 2003 by Réda BOUREBABA
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid