function GetFileVersion(const fn: String): String; var tmp, InfoSize, FileInfoSize: DWord; Info: Pointer; FileInfo: PVSFixedFileInfo; function IntToStr(i: Integer): String; begin Str(i, result) end; begin result:=''; FileInfo:=nil; InfoSize:=GetFileVersionInfoSize(pChar(fn), tmp); if InfoSize = 0 then Exit; GetMem(Info, InfoSize); GetFileVersionInfo(pChar(fn), 0, InfoSize, Info); VerQueryValue(Info, '\', Pointer(FileInfo), FileInfoSize); with FileInfo^ do result:=inttostr(dwProductVersionMS shr 16) +'.' +inttostr(dwProductVersionMS and $FFFF) +'.' +inttostr(dwProductVersionLS shr 16) +'.' +inttostr(dwProductVersionLS and $FFFF); FreeMem(Info, InfoSize); end; procedure TForm1.Button4Click(Sender: TObject); var a:string; begin showmessage(GetFileVersion('Arquivo.exe'));