Einzelnen Beitrag anzeigen

taaktaak

Registriert seit: 25. Okt 2007
Ort: Radbruch
1.990 Beiträge
 
Delphi 7 Professional
 
#5

Re: Version des eigenes Programms ermitteln

  Alt 21. Nov 2008, 19: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
  Mit Zitat antworten Zitat