<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Серый форум &mdash; AHK: отслеживание подключения дисков]]></title>
		<link>https://forum.script-coding.com/viewtopic.php?id=875</link>
		<atom:link href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=875&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «AHK: отслеживание подключения дисков».]]></description>
		<lastBuildDate>Thu, 29 May 2014 14:48:16 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: AHK: отслеживание подключения дисков]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=83492#p83492</link>
			<description><![CDATA[<p>Отслеживание события подключения/отключения диска и получение его буквы:<br /></p><div class="codebox"><pre><code>OnMessage(0x219, &quot;WM_DEVICECHANGE&quot;)
return

EventHandling(drive, event)
{
   TrayTip, Диск %drive%:, %event%,, 1
}

WM_DEVICECHANGE(wp, lp)
{
   static DBT_DEVICEARRIVAL := 0x8000, DBT_DEVICEREMOVECOMPLETE := 0x8004, DBT_DEVTYP_VOLUME := 2
   
   if ((wp = DBT_DEVICEARRIVAL || wp = DBT_DEVICEREMOVECOMPLETE) &amp;&amp; NumGet(lp+4, &quot;UInt&quot;) = DBT_DEVTYP_VOLUME)
   {
      dbcv_unitmask := NumGet(lp+12, &quot;UInt&quot;)
   
      Loop
         Letter := Chr(Asc(&quot;A&quot;) + A_Index - 1)
      until (dbcv_unitmask &gt;&gt; (A_Index - 1))&amp;1
      
      EventHandling(Letter, wp = DBT_DEVICEARRIVAL ? &quot;подключен&quot; : &quot;отключен&quot;)
   }
}</code></pre></div><p>Информация:<br /><a href="http://msdn.microsoft.com/en-us/library/windows/desktop/aa363480%28v=vs.85%29.aspx">WM_DEVICECHANGE</a><br /><a href="http://msdn.microsoft.com/en-us/library/windows/desktop/aa363249%28v=vs.85%29.aspx">DEV_BROADCAST_VOLUME structure</a><br /><a href="http://forum.script-coding.com/viewtopic.php?id=8785">Связанная тема</a></p>]]></description>
			<author><![CDATA[null@example.com (teadrinker)]]></author>
			<pubDate>Thu, 29 May 2014 14:48:16 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=83492#p83492</guid>
		</item>
		<item>
			<title><![CDATA[AHK: отслеживание подключения дисков]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=6314#p6314</link>
			<description><![CDATA[<p>Скрипт отслеживает момент подключения/отключения диска:<br /></p><div class="codebox"><pre><code>OnMessage(0x219, &quot;notify_change&quot;) ; WM_DEVICECHANGE
Return

notify_change(wParam, lParam, msg, hwnd)
{
    MsgBox, %wParam% %lParam% %msg% %hwnd%
}</code></pre></div><p>Вывод подключенных съёмных дисков:<br /></p><div class="codebox"><pre><code>SetFormat, Integer, H
DriveGet, DrvList, List, Removable
Loop, Parse, DrvList
{
   DriveGet, DrvSerial, Serial, %A_Loopfield%:
   StringTrimLeft, DrvSerial, DrvSerial, 2
   StringUpper, DrvSerial, DrvSerial
   MsgBox, Serial Number of  %A_Loopfield%: is %DrvSerial%
}</code></pre></div><p>Примеры опубликовал <strong>Wlad</strong>.</p>]]></description>
			<author><![CDATA[null@example.com (The gray Cardinal)]]></author>
			<pubDate>Thu, 22 Nov 2007 20:27:38 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=6314#p6314</guid>
		</item>
	</channel>
</rss>
