With the original GetFileVersionInfo can only get Delpi7 version number, used in Delphi2010 no use
//------Get the file version number
function F_getfileversion (fn:string): string;
var
Temp, infosize:cardinal;
Filedata:pointer;
Fileinfo:pvsfixedfileinfo;
begin
Result: = ';
if not fileexists (FN) then Exit;
infosize: = GetFileVersionInfoSize (PChar (FN), Temp);
if infosize = 0 then Exit; No version number
FileData: = GetMemory (infosize);
Try
if not GetFileVersionInfo (PChar (FN), 0, Infosize, FileData) then Exit;
if not VerQueryValue (FileData, "\", Pointer (FileInfo), Temp) then Exit;
Result: = Format ('%d.%d.%d.%d ',
[Fileinfo.dwfileversionms div $10000,
fileinfo.dwfileversionms MoD $10000,
fileinfo.dwfileversionls Div $10000,
fileinfo.dwfileversionls mod $10000]);
finally
freememory (FileData)
end;
The solution is to use a third-party control rave, there is a rzversioninofo, put on the compile time check including version information in project, you can get the version number, get method: ShowMessage ( rzversioninofo1.fileversion);
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Delphi2010 How to get the internal version number of the program?