Registriert seit: 25. Okt 2007
Ort: Radbruch
1.993 Beiträge
Delphi 7 Professional
|
Re: Version des eigenes Programms ermitteln
21. Nov 2008, 20:31
Hab' da noch eine Version, die weitere Informationen ermittelt:
Delphi-Quellcode:
procedure GetFileVersionInfos(List:TStrings;ItemNo:Word=0);
const SubBlock = 'StringFileInfo\040704E4\';
InfoNum = 10;
InfoStr : Array[1..InfoNum] of String
= ('CompanyName',
'FileDescription',
'FileVersion',
'InternalName',
'LegalCopyright',
'LegalTradeMarks',
'OriginalFileName',
'ProductName',
'ProductVersion',
'Comments');
var n,Len,i : DWORD;
Buf : PChar;
Value : PChar;
begin
n:=GetFileVersionInfoSize(PChar(Application.ExeName),n);
if n=0 then List.Add('No version information found')
else begin
List.Clear;
Buf:=AllocMem(n);
Windows.GetFileVersionInfo(PChar(Application.ExeName),0,n,Buf);
for i:=1 to InfoNum do
if VerQueryValue(Buf,PChar(SubBlock+InfoStr[i]),Pointer(Value),Len) then
if (ItemNo=0) or
(ItemNo=i) then List.Add(InfoStr[i]+'='+Value);
FreeMem(Buf,n)
end
end;
Ralph
|
|
Zitat
|