How to extract the version number (in 4 digits) of the program in Delphi and write to some variable?

    1 answer 1

    Already found, the answer is not worth it.

    function GetMyVersion:string; type TVerInfo=packed record Nevazhno: array[0..47] of byte; // ненужные нам 48 байт Minor,Major,Build,Release: word; // а тут версия end; var s:TResourceStream; v:TVerInfo; begin result:=''; try s:=TResourceStream.Create(HInstance,'#1',RT_VERSION); // достаём ресурс if s.Size>0 then begin s.Read(v,SizeOf(v)); // читаем нужные нам байты result:=IntToStr(v.Major)+'.'+IntToStr(v.Minor)+'.'+ // вот и версия... IntToStr(v.Release)+'.'+IntToStr(v.Build); end; s.Free; except; end; end; 
    • one
      It is better to write a line with result as result: = Format ('% d.% d.% d.% d', [v.Major, v.Minor, v.Release, v.Build]); - volandino