06-20-2011، 01:27 PM
کد:
function GetVersion(sFileName:string): string;
var
VerInfoSize: DWORD;
VerInfo: Pointer;
VerValueSize: DWORD;
VerValue: PVSFixedFileInfo;
Dummy: DWORD;
begin
VerInfoSize := GetFileVersionInfoSize(PChar(sFileName), Dummy);
GetMem(VerInfo, VerInfoSize);
GetFileVersionInfo(PChar(sFileName), 0, VerInfoSize, VerInfo);
VerQueryValue(VerInfo, '\', Pointer(VerValue), VerValueSize);
with VerValue^ do
begin
Result := IntToStr(dwFileVersionMS shr 16);
Result := Result + '.' + IntToStr(dwFileVersionMS and $FFFF);
Result := Result + '.' + IntToStr(dwFileVersionLS shr 16);
Result := Result + '.' + IntToStr(dwFileVersionLS and $FFFF);
end;
FreeMem(VerInfo, VerInfoSize);
end;
procedure Form1.Button1Click(Sender: TObject);
begin
ShowMessage(GetVersion('c:\test.exe'));
end;
با سورس بالا در دلفی میتونید ورژن فایل exe رو بدست بیارید.