Cita:
Empezado por roman
Pero, ¿usas directamente la API de Windows o la función de la unidad SysUtils?
// Saludos
|
Ahí me has pillado... voy a ver...
Es la que está implementada en 'windows'; y es este código horroroso:
Código Delphi
[-]function getmVersion(cExe:string='') : string;
var
InfoSize, H, RsltLen: cardinal;
VersionBlock: pointer;
Rslt: PVSFixedFileInfo;
begin
if (cExe='') or (not FileExists(cExe)) then
cExe := Application.ExeName;
InfoSize := GetFileVersionInfoSize(pChar(cExe), H);
VersionBlock := AllocMem(InfoSize);
try
GetFileVersionInfo(pChar(cExe), H, InfoSize, VersionBlock);
VerQueryValue(VersionBlock, '\', Pointer(Rslt), RsltLen);
result := Format('%d.%d.%d.%d', [
Rslt.dwProductVersionMS div 65536,
Rslt.dwProductVersionMS mod 65536,
Rslt.dwProductVersionLS div 65536,
Rslt.dwProductVersionLS mod 65536]);
finally
FreeMem(VersionBlock);
end;
end;