Chris Hallowes wrote:

> Try this
>
> function GetExeVersionStr: string;
> var
>         Dummy: DWORD;
>         FileVerInfoSize: integer;
>         Buffer: PChar;
>         PFFI: PVSFixedFileInfo;
>         FFISize: DWORD;
> begin
>         FileVerInfoSize :=
> GetFileVersionInfoSize(PChar(Application.EXEName), Dummy);

We use that as well.

This is a little bit off topic - but we found a useful technique
to automatically increment the version number for
each release you do which might be of interest.

It's important for your installation programs
to make sure that every official release goes out with an
incremented version number.  A more recent
version should always over-writes the older version - and
that you never over-write a new version by an old version.

The trick is that the Delphi application resource file is a standard windows
resource
file - you can open YourApp.res in Visual C++ and save it as a YourApp.rc
file.   The YourApp.rc file is a text
file that understands the C pre-processor so you can include any header file in

it before compiling it into a binary resource with the Visual C++ resource
compiler RC.EXE.

We include this file:

#ifndef __HL7_VERSION__
// auto generated - you may only edit the HL7_VERSION_MAJOR
// and HL7_VERSION_MINOR values directly - the MINOR version
// is incremented by the versionlabel script.
#define __HL7_VERSION__
#define HL7_VERSION_MAJOR 1
#define HL7_VERSION_MINOR 27
#define HL7_STRING_VERSION    "1,27,0,0"

which is parsed by our version labeling script and re-output with the
HL7_VERSION_MINOR number incremented with each release.

The *.rc file then uses the C pre-processor to replace the version
tokens in the resource file i.e.

#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
#include "..\admin\HL7version.h"

/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS

/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources

#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32

/////////////////////////////////////////////////////////////////////////////
//
// Icon
//

// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
MAINICON                ICON    IMPURE DISCARDABLE "mainicon.ico"


#ifndef _MAC
/////////////////////////////////////////////////////////////////////////////
//
// Version
//

1 VERSIONINFO
 FILEVERSION HL7_VERSION_MAJOR,HL7_VERSION_MINOR,0,1
 PRODUCTVERSION HL7_VERSION_MAJOR,HL7_VERSION_MINOR,0,1
 FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
 FILEFLAGS 0x1L
#else
 FILEFLAGS 0x0L
#endif
 FILEOS 0x4L
 FILETYPE 0x1L
 FILESUBTYPE 0x0L
BEGIN
    BLOCK "StringFileInfo"
    BEGIN
        BLOCK "040904E4"
        BEGIN
            VALUE "CompanyName", "Interface Ware\0"
            VALUE "FileDescription", "GUI for HL7 engine configuration.\0"
            VALUE "FileVersion", HL7_STRING_VERSION
            VALUE "InternalName", "Visual Message Studio\0"
            VALUE "LegalCopyright", "\0"
            VALUE "LegalTrademarks", "\0"
            VALUE "OriginalFilename", "VMstudio.exe\0"
            VALUE "ProductName", "Visual Message Studio\0"
            VALUE "ProductVersion", HL7_STRING_VERSION
            VALUE "Comments", "\0"
        END
    END
    BLOCK "VarFileInfo"
    BEGIN
        VALUE "Translation", 0x409, 1252
    END
END

#endif    // !_MAC


#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//

1 TEXTINCLUDE DISCARDABLE
BEGIN
    "resource.h\0"
END

2 TEXTINCLUDE DISCARDABLE
BEGIN
    "#include ""afxres.h""\r\n"
    "\0"
END

3 TEXTINCLUDE DISCARDABLE
BEGIN
    "\r\n"
    "\0"
END

#endif    // APSTUDIO_INVOKED

#endif    // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////

Then in the batch file which is called during our auto build process to build
the Delphi app in our product we call the Visual C++ resource compiler
(RC.EXE) to compile our Delphi applications resource file i.e

RC.EXE VisualMessageStudio.rc
DCC32.EXE /U..\Complete /U..\TopSupport VisualMessageStudio.dpr

It might seem a bit long winded - but the end result is we can do a release
within
spit out a setup file at the end of it which it guaranteed to correctly install
in about
10 minites with just the commands:

> versionlabel RELEASEXX
> buildall RELEASEXX



---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz

Reply via email to