Board index » delphi » version number

version number


2004-02-05 10:01:08 PM
delphi116
I need a way to get the version number of my application. In delphi-help
there is example code, but this doesn't work. It only displays
'VersionInfoSize' and nothing futher. It doesn't come by the if-statement
[ if VerQueryValue(Buf, PChar('StringFileInfo\040904E4\' + InfoStr[i]),
Pointer(Value), Len) ]. If I remove the if-statement it prints weird signs
(probably pointer stuff). Does anybody know what to do???
code from delphi-help:
===============
procedure TForm1.Button1Click(Sender: TObject);
const
InfoNum = 10;
InfoStr: array[1..InfoNum] of string = ('CompanyName', 'FileDescription',
'FileVersion', 'InternalName', 'LegalCopyright', 'LegalTradeMarks',
'OriginalFileName', 'ProductName', 'ProductVersion', 'Comments');
var
S: string;
n, Len, i: DWORD;
Buf: PChar;
Value: PChar;
begin
S := Application.ExeName;
n := GetFileVersionInfoSize(PChar(S), n);
if n>0 then
begin
Buf := AllocMem(n);
Memo1.Lines.Add('VersionInfoSize = ' + IntToStr(n));
GetFileVersionInfo(PChar(S), 0, n, Buf);
for i := 1 to InfoNum do
if VerQueryValue(Buf, PChar('StringFileInfo\040904E4\' + InfoStr[i]),
Pointer(Value), Len) then
Memo1.Lines.Add(InfoStr[i] + ' = ' + Value);
FreeMem(Buf, n);
end
else
Memo1.Lines.Add('No version information found');
end;
 
 

Re:version number

Please do not cross-post your messages. Doing so violates Borland's
rules for the use of their news server, which you can read here:
info.borland.com/newsgroups/guide.html
In the future, please choose a single, appropriate newsgroup for your
post.
To read version information, look at this component, which comes with
source code:
www.logicfundamentals.com/freestuff/versinfo.zip
-Craig
--
Craig Stuntz [TeamB] . Vertex Systems Corp. . Columbus, OH
Delphi/InterBase Weblog : delphi.weblogs.com
Everything You Need to Know About InterBase Character Sets:
delphi.weblogs.com/stories/storyReader$306