Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Showing Version Info Number in About Box 2

Status
Not open for further replies.

StevenK

Programmer
Jan 5, 2001
1,294
GB
I have set the project options such that we increment the build number for the application file. By right-clicking the project icon in Windows Explorer we can see the build number (version 2.3.4.1 for instance). How do we show this value in the 'About' box of the application so that we have a quick tally for users to determine if they have the latest build of the application ...
Thanks in advance.
Steve.
 
Try this...

{ have this code in your form show event of your about form
}
Label1.Caption := 'Version ' + GetEXEInfo('ProductVersion');

{ have this function either in the about form code or some global piece of code
}
function GetEXEInfo(sInfo: String): String;
var
S : String;
sTmpVersion: String;
Len : DWORD;
n : DWORD;
Value : PChar;
Buf : PChar;
begin
S := Application.ExeName;
n := GetFileVersionInfoSize(PChar(S),n);
Result := '';

if n > 0 then begin
SetLength(sTmpVersion, 200);
Value := @sTmpVersion;
Buf := AllocMem(n);
GetFileVersionInfo(PChar(S),0,n,Buf);
// 1009 = Canadian "found in Project/Options/Version Info/Language"
if VerQueryValue(Buf,PChar('StringFileInfo\100904E4\' + sInfo),
Pointer(Value),Len) then Result := Value;

FreeMem(Buf,n);
end;
end;

Paul Wesson
paul@wessoft.com
 
Great sollution, it helped me a lot.

And if you replace
Code:
Label1.Caption := 'Version ' + GetEXEInfo('ProductVersion');

with
Code:
Label1.Caption := 'Version ' + GetEXEInfo('FileVersion');

You get the version Id that is put into the Exe-file when building it.


Bas Schouten
System Development & Webdesign
CBIS BV Holland
logo.gif
 
This guy has produced a component (Getver) which extracts all the version and file information from files.
I have encapsulated it in my own generic aboutbox works well.
This is his email address, but you should find it with a web serch for getver.
Bernd Juergens email :bernd@promedico.com

Just for the record Steve..

 
If anyone knows how to do this version info stuff from the command prompt, can you let me know? Obviously I have the dof file setup correctly, but is there something I need to setup in dcc32.cfg or <projname>.cfg to make it work via command prompt?
 
If you use Delphi to write a console program (File | New... | Console application) that grabs the version number out of an exe and then WriteLn's it out, you could then use that prog to read version numbers from the command line. -- Doug Burbidge mailto:doug@ultrazone.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top