<?xml version='1.0' encoding="utf-8"?>
      <rss version='2.0'>
      <channel>
      <title>Форум на Исходниках.RU</title>
      <link>https://forum.sources.ru</link>
      <description>Форум на Исходниках.RU</description>
      <generator>Форум на Исходниках.RU</generator>
  	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=40167&amp;view=findpost&amp;p=260337</guid>
        <pubDate>Tue, 09 Dec 2003 13:38:15 +0000</pubDate>
        <title>Прочитать номер версии</title>
        <link>https://forum.sources.ru/index.php?showtopic=40167&amp;view=findpost&amp;p=260337</link>
        <description><![CDATA[Vit:  <!--c1--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b></b> </td></tr><tr><td id='CODE'><!--ec1-->function FileVersion&#40;AFileName&#58;string&#41;&#58; string; <br>var <br> &nbsp;szName&#58; array&#91;0..255&#93; of Char; <br> &nbsp;P&#58; Pointer; <br> &nbsp;Value&#58; Pointer; <br> &nbsp;Len&#58; UINT; <br> &nbsp;GetTranslationString&#58;string; <br> &nbsp;FFileName&#58; PChar; <br> &nbsp;FValid&#58;boolean; <br> &nbsp;FSize&#58; DWORD; <br> &nbsp;FHandle&#58; DWORD; <br> &nbsp;FBuffer&#58; PChar; <br>begin <br> &nbsp;try <br> &nbsp; &nbsp;FFileName &#58;= StrPCopy&#40;StrAlloc&#40;Length&#40;AFileName&#41; + 1&#41;, AFileName&#41;; <br> &nbsp; &nbsp;FValid &#58;= False; <br> &nbsp; &nbsp;FSize &#58;= GetFileVersionInfoSize&#40;FFileName, FHandle&#41;; <br> &nbsp; &nbsp;if FSize &#62; 0 then <br> &nbsp; &nbsp; &nbsp;try <br> &nbsp; &nbsp; &nbsp; &nbsp;GetMem&#40;FBuffer, FSize&#41;; <br> &nbsp; &nbsp; &nbsp; &nbsp;FValid &#58;= GetFileVersionInfo&#40;FFileName, FHandle, FSize, FBuffer&#41;; <br> &nbsp; &nbsp; &nbsp;except <br> &nbsp; &nbsp; &nbsp; &nbsp;FValid &#58;= False; <br> &nbsp; &nbsp; &nbsp; &nbsp;raise; <br> &nbsp; &nbsp; &nbsp;end; <br> &nbsp; &nbsp;Result &#58;= &#39;&#39;; <br> &nbsp; &nbsp;if FValid then <br> &nbsp; &nbsp; &nbsp;VerQueryValue&#40;FBuffer, &#39;&#092;VarFileInfo&#092;Translation&#39;, p, Len&#41; <br> &nbsp; &nbsp;else p &#58;= nil; <br> &nbsp; &nbsp;if P &#60;&#62; nil then <br> &nbsp; &nbsp; &nbsp;GetTranslationString &#58;= IntToHex&#40;MakeLong&#40;HiWord&#40;Longint&#40;P^&#41;&#41;, LoWord&#40;Longint&#40;P^&#41;&#41;&#41;, 8&#41;; <br> &nbsp; &nbsp;if FValid then <br> &nbsp; &nbsp; &nbsp;begin <br> &nbsp; &nbsp; &nbsp; &nbsp;StrPCopy&#40;szName, &#39;&#092;StringFileInfo&#092;&#39; + GetTranslationString + &#39;&#092;FileVersion&#39;&#41;; <br> &nbsp; &nbsp; &nbsp; &nbsp;if VerQueryValue&#40;FBuffer, szName, Value, Len&#41; then <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Result &#58;= StrPas&#40;PChar&#40;Value&#41;&#41;; <br> &nbsp; &nbsp; &nbsp;end; <br> &nbsp;finally <br> &nbsp; &nbsp;try <br> &nbsp; &nbsp; &nbsp;if FBuffer &#60;&#62; nil then FreeMem&#40;FBuffer, FSize&#41;; <br> &nbsp; &nbsp;except <br> &nbsp; &nbsp;end; <br> &nbsp; &nbsp;try <br> &nbsp; &nbsp; &nbsp;StrDispose&#40;FFileName&#41;; <br> &nbsp; &nbsp;except <br> &nbsp; &nbsp;end; <br> &nbsp;end; <br>end; <!--c2--></td></tr></table><div class='postcolor'><!--ec2--><br><br>В качестве параметра задать имя программы, если своей программы: <br><br>FileVersion(Paramstr(0)); <br> <br> ]]></description>
        <author>Vit</author>
        <category>Работа с файлами, форматы файлов и данных</category>
      </item>
	
      </channel>
      </rss>
	