<?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=9873&amp;type=atom" />
	<updated>2014-08-10T22:31:40Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=9873</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Воспроизведение звука из исполняемого файла]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=85797#p85797" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>Странникх пишет:</cite><blockquote><p>Ваш способ ведь будет работать с другими файлами (картинками например для GUI) ?</p></blockquote></div><p>Нет, это только для wav-ресурсов, с картинками по-другому.</p><p>С помощью FileInstall:<br /></p><div class="codebox"><pre><code>ResRead(Sound, &quot;C:\Windows\Media\tada.wav&quot;) &amp;&amp; PlaySound(Sound)
Return

FileInstall, C:\Windows\Media\tada.wav, tada.wav   ; эта команда сработает только для компилятора
Return

ResRead(ByRef Data, FilePath)
{
   if !A_IsCompiled
   {
      FileGetSize, nSize, %FilePath%
      FileRead, Data, *c %FilePath%
   }
   
   else if (hMod     := DllCall(&quot;GetModuleHandle&quot;, UInt, 0, Ptr))
        &amp;&amp; (hRes     := DllCall(&quot;FindResource&quot;, Ptr, hMod, Str, FilePath, UInt, RT_RCDATA := 10, Ptr))
        &amp;&amp; (hResData := DllCall(&quot;LoadResource&quot;, Ptr, hMod, Ptr, hRes, Ptr))
        &amp;&amp; (pResData := DllCall(&quot;LockResource&quot;, Ptr, hResData, Ptr))
      VarSetCapacity(Data, nSize := DllCall(&quot;SizeofResource&quot;, Ptr, hMod, Ptr, hResData))
         , DllCall(&quot;RtlMoveMemory&quot;, Str, Data, Ptr, pResData, Ptr, nSize)
         
   Return nSize
}

PlaySound(ByRef Sound)
{
   Return DllCall(&quot;Winmm\PlaySound&quot;, Ptr, &amp;Sound, UInt, 0, UInt, SND_MEMORY := 0x4 | SND_NODEFAULT := 0x2)
}</code></pre></div><p>С помощью Ресторатора. Создать идентификатор ресурса WAVE, назвать ресурс числом (ResourceName := 123)<br /></p><div class="codebox"><pre><code>ResourceName := 123

SND_NODEFAULT := 2, SND_ASYNC := 0x1, SND_RESOURCE := 0x40004
DllCall(&quot;Winmm\PlaySound&quot;, UInt, ResourceName, Ptr, DllCall(&quot;GetModuleHandle&quot;, UInt, 0, Ptr), UInt, SND_NODEFAULT|SND_ASYNC|SND_RESOURCE)</code></pre></div>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2014-08-10T22:31:40Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=85797#p85797</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Воспроизведение звука из исполняемого файла]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=85738#p85738" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>teadrinker пишет:</cite><blockquote><div class="quotebox"><cite>ypppu пишет:</cite><blockquote><p>Можно сначала извлечь файл .wav в папку %Temp%, а затем воспроизвести его.</p></blockquote></div><p>Wav можно проиграть и без извлечения, прямо из ресурсов. Если кому нужно, могу написать.</p></blockquote></div><p>Тоже может понадобиться, напишите, пожалуйста. Ваш способ ведь будет работать с другими файлами (картинками например для GUI) ?</p>]]></content>
			<author>
				<name><![CDATA[Странникх]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=30605</uri>
			</author>
			<updated>2014-08-07T13:40:52Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=85738#p85738</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Воспроизведение звука из исполняемого файла]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=85737#p85737" />
			<content type="html"><![CDATA[<p>Было бы неплохо.</p>]]></content>
			<author>
				<name><![CDATA[sergeiplugatyr]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=30382</uri>
			</author>
			<updated>2014-08-07T13:31:56Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=85737#p85737</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Воспроизведение звука из исполняемого файла]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=85731#p85731" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>ypppu пишет:</cite><blockquote><p>Можно сначала извлечь файл .wav в папку %Temp%, а затем воспроизвести его.</p></blockquote></div><p>Wav можно проиграть и без извлечения, прямо из ресурсов. Если кому нужно, могу написать.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2014-08-07T12:51:38Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=85731#p85731</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Воспроизведение звука из исполняемого файла]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=85730#p85730" />
			<content type="html"><![CDATA[<p><span style="color: green">Участник <strong>BashkaMen</strong> заблокирован за постоянные нарушения правил форума.</span></p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2014-08-07T12:50:13Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=85730#p85730</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Воспроизведение звука из исполняемого файла]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=85722#p85722" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>BashkaMen пишет:</cite><blockquote><p>Fileinstall, путь к файлу\file.wav, %a_temp%\file.wav<br />Soundpaly, %a_temp%\file.wav</p></blockquote></div><p>Спасибо, но я уже разобрался <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /></p>]]></content>
			<author>
				<name><![CDATA[Desire]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=30401</uri>
			</author>
			<updated>2014-08-07T09:57:27Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=85722#p85722</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Воспроизведение звука из исполняемого файла]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=85720#p85720" />
			<content type="html"><![CDATA[<p>Fileinstall, путь к файлу\file.wav, %a_temp%\file.wav<br />Soundpaly, %a_temp%\file.wav</p>]]></content>
			<author>
				<name><![CDATA[BashkaMen]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=30800</uri>
			</author>
			<updated>2014-08-07T09:38:45Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=85720#p85720</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Воспроизведение звука из исполняемого файла]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=85704#p85704" />
			<content type="html"><![CDATA[<p>Подробности - в описании команды <em>FileInstall</em>.</p>]]></content>
			<author>
				<name><![CDATA[ypppu]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=5974</uri>
			</author>
			<updated>2014-08-06T17:31:01Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=85704#p85704</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Воспроизведение звука из исполняемого файла]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=85703#p85703" />
			<content type="html"><![CDATA[<p>Откуда извлечь и как в &quot;это&quot; засунуть файл? <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /></p>]]></content>
			<author>
				<name><![CDATA[Desire]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=30401</uri>
			</author>
			<updated>2014-08-06T16:54:14Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=85703#p85703</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Воспроизведение звука из исполняемого файла]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=85701#p85701" />
			<content type="html"><![CDATA[<p>Можно сначала извлечь файл .wav в папку %Temp%, а затем воспроизвести его.</p>]]></content>
			<author>
				<name><![CDATA[ypppu]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=5974</uri>
			</author>
			<updated>2014-08-06T16:13:11Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=85701#p85701</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[AHK: Воспроизведение звука из исполняемого файла]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=85700#p85700" />
			<content type="html"><![CDATA[<p>Здравствуйте. Интересует такой вопрос:<br />Можно ли как-нибудь засунуть .wav звук в скомпилированный скрипт, чтобы воспроизводить его оттуда?<br />Просто необходимо, чтобы файл не лежал напрямую в системе.</p>]]></content>
			<author>
				<name><![CDATA[Desire]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=30401</uri>
			</author>
			<updated>2014-08-06T16:04:29Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=85700#p85700</id>
		</entry>
</feed>
