Solved

Delphi Programming question

Posted on 1997-08-29
1
581 Views
Last Modified: 2012-06-27
The Delphi 3 IDE has a provision to automatically increment the build number of the application.  This feature appears disabled from the command-line DCC32 compiler.

I am looking for a way FROM DCC32 to set the build number to a given value, as well as the other versioning fields.  I suspect it may take a comand line resource editor.

I already know how to READ the version information using combinations of GetFileVersionInfoSize, GetFileVersionInfo, and VerQueryValue.

My question is how to SET these.  That can be via comand line, or tools so that I can write an app to do it for me, and I'll make that app comand line.

It is less important that these values be correct inside of the DPR, and more important that the final EXE contain the proper values.

The pupose of doing this is to better integrate the labeling of source code in PVCS with the resultant EXE that is released.
0
Comment
Question by:cashew
1 Comment
 
LVL 1

Accepted Solution

by:
arh earned 60 total points
Comment Utility
Delphi stores version info  from Project|Options|VersionInfo
dialog box in the file <your-project-name>.res. If you don't want to cope
with windows binary resource format, there is the only way to change
this info from outside Delphi.
 First, disable "include version information in project" check box
(if you don't, there will finally be two VERSIONINFO in exe, and any
program dealing with this will be very confused).
 Second, provide this information by yourself (it will not be
available in Delphi IDE). Here is how:

1) Create text resource file, named, for example, ver.rc:
(format of VERSIONINFO statement is (poorly) documented in windows
API help)

  1 VERSIONINFO LOADONCALL MOVEABLE DISCARDABLE IMPURE
  FILEVERSION 1, 0, 0, 0
  PRODUCTVERSION 1, 0, 0, 0
  FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
  FILEOS VOS__WINDOWS32
  FILETYPE VFT_APP
  {
  BLOCK "StringFileInfo"
    {  
    BLOCK "040904E4"  
      {  
      VALUE "CompanyName", "Sample Company"  
      VALUE "FileDescription", "Sample project"  
      VALUE "FileVersion", "1.0"  
      VALUE "InternalName", "sample"  
      VALUE "LegalCopyright", ""  
      VALUE "LegalTrademarks", ""  
      VALUE "OriginalFilename", "sample.exe"  
      VALUE "ProductName", "sample"  
      VALUE "ProductVersion", "1.0"  
      VALUE "Comments", ""  
      }
    }
    BLOCK "VarFileInfo"
      {  
      VALUE "Translation", 1033, 1252
      }
  }

Sample VERSIONINFO statement can be extracted from .res or .exe file
by resource editor (from Borland C++, Delphi RAD pack or MS Visual C++).
This text file can be generated by your program, which will substitute
proper values in place of version numbers etc.

2). Compile this .rc file by resource compiler:
  brcc32 ver.rc
It will create binary resource file ver.res

3). Include reference to this .res file in your project:

  program d3vinfo;

  uses
    Forms,
    main in 'main.pas' {Form1};

  {$R *.RES}
  {$R ver.res }

  begin
    Application.Initialize;
    Application.CreateForm(TForm1, Form1);
    Application.Run;
  end.

Actually, you could provide version info in your .exe this way
since Delphi 1.

0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This video discusses moving either the default database or any database to a new volume.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

762 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now