I have an application compiled for Compact Framework which I need to find the version number for using Delphi 2006. I am using the code below.
function VersionNumber(ExeFile: string): string;
var
Size: Longint;
Dummy: Cardinal;
Buffer: Pointer;
FileInfo: Pointer;
begin
Size := GetFileVersionInfoSize(PChar(ExeFile), Dummy);
GetMem(Buffer, Size);
if (GetFileVersionInfo(PChar(ExeFile), Dummy, Size, Buffer)) then begin
//VerQueryValue(Buffer, '\\', FileInfo, Dummy);
//with PVSFixedFileInfo(FileInfo)^ do
//Result := IntToStr(dwFileVersionMS div $10000) + '.' +
// IntToStr(dwFileVersionMS mod $10000) + '.' +
// IntToStr(dwFileVersionLS div $10000) + ' (' +
// IntToStr(dwFileVersionLS mod $10000) + ')';
end
else begin
Result := 'No version info available.';
end;
FreeMem(Buffer, Size);
end;
If I view the file details using Windows 7 I cannot see the version number there either, so it's not surprising that I cannot get it from Delphi.
Just on the off chance someone knows a way to get the version number it would be greatly appreciated.
UPDATE
This code was written more then a decade ago by an ex staff member. Up until now, it has worked fine, but has never been tried on an executable compiled for Compact Framework.
The GetFileVersionInfo function is returning false, so I am getting 'No version info available.' result.