<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; AHK: Определение размера файла в сети]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=6324&amp;type=atom" />
	<updated>2011-10-17T20:00:57Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=6324</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Определение размера файла в сети]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=52587#p52587" />
			<content type="html"><![CDATA[<p>У меня вот так получилось:<br /></p><div class="codebox"><pre><code>url = http://www.autohotkey.net/~Lexikos/AutoHotkey_L/AutoHotkey_L_Install.exe
 
MsgBox, % GetFileSizeFromInternet(url)   ; размер в байтах
 
GetFileSizeFromInternet(url, ProxyName = &quot;&quot;, ProxyBypass = &quot;&quot;)
{
   INTERNET_OPEN_TYPE_DIRECT = 1
   INTERNET_OPEN_TYPE_PROXY = 3
   AccessType := ProxyName ? INTERNET_OPEN_TYPE_DIRECT : INTERNET_OPEN_TYPE_PROXY
   INTERNET_FLAG_RELOAD = 0x80000000
   HTTP_QUERY_CONTENT_LENGTH = 5
   coding := A_IsUnicode ? &quot;W&quot; : &quot;A&quot;
 
   hModule := DllCall(&quot;LoadLibrary&quot;, Str, &quot;wininet.dll&quot;)
   hInternet := DllCall(&quot;wininet\InternetOpen&quot; . coding
                  , Str, &quot;&quot;   
                  , UInt, INTERNET_OPEN_TYPE_DIRECT
                  , Str, &quot;&quot;
                  , Str, &quot;&quot;
                  , UInt, 0)
   if !hInternet
   {
      Error := A_LastError
      DllCall(&quot;FreeLibrary&quot;, UInt, hModule)
      Return &quot;Ошибка &quot; . Error
   }
 
   hFile := DllCall(&quot;wininet\InternetOpenUrl&quot; . coding
               , UInt, hInternet
               , Str, url
               , Str, &quot;&quot;
               , UInt, 0
               , UInt, INTERNET_FLAG_RELOAD
               , UInt, 0)
   if !hFile
   {
      Error := A_LastError
      DllCall(&quot;wininet\InternetCloseHandle&quot;, UInt, hInternet)
      DllCall(&quot;FreeLibrary&quot;, UInt, hModule)
      Return &quot;Ошибка &quot; . Error
   }
 
   VarSetCapacity(buff, 64)
   VarSetCapacity(bufflen, 2)
   Loop 4
   {
      success := DllCall(&quot;wininet\HttpQueryInfo&quot; . coding
                  , UInt, hFile
                  , UInt, HTTP_QUERY_CONTENT_LENGTH
                  , UInt, &amp;buff
                  , UInt, &amp;bufflen
                  , UInt, 0)
      if success
         Break
   }
   Result := success ? StrGet(&amp;buff) : &quot;Невозможно извлечь информацию&quot;
 
   DllCall(&quot;wininet\InternetCloseHandle&quot;, UInt, hInternet)
   DllCall(&quot;wininet\InternetCloseHandle&quot;, UInt, hFile)
   DllCall(&quot;FreeLibrary&quot;, UInt, hModule)
 
   Return Result
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2011-10-17T20:00:57Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=52587#p52587</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Определение размера файла в сети]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=52572#p52572" />
			<content type="html"><![CDATA[<p>При использовании <em>urldownloadtofile</em> такой возможности, кажется, нет. Зато можно сделать звуковой сигнал или окно с сообщением сразу после загрузки файла.</p>]]></content>
			<author>
				<name><![CDATA[ypppu]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=5974</uri>
			</author>
			<updated>2011-10-17T15:04:14Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=52572#p52572</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[AHK: Определение размера файла в сети]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=52566#p52566" />
			<content type="html"><![CDATA[<p>Доброго времени суток уважаемые участники форума:)<br />пишу я скриптик. одной из его задач является скачивание файлика с интернета.<br />для проверки, полностью ли докачался файл мне нужно узнать его размер чтобы потом сравнить со скаченным.<br />FileGetSize,var,http://блаблабла.exe ничего умного не приносит.</p><p>Как же быть?</p>]]></content>
			<author>
				<name><![CDATA[Footman]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=25878</uri>
			</author>
			<updated>2011-10-17T07:58:35Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=52566#p52566</id>
		</entry>
</feed>
