Solved

Delphi Programming question

Posted on 1997-08-29
1
587 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
[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
1 Comment
 
LVL 1

Accepted Solution

by:
arh earned 60 total points
ID: 1342947
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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

737 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