<?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=7827&amp;type=atom" />
	<updated>2012-11-29T09:52:47Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=7827</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Как определить можно-ли безопасно извлечь флэшку?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=66286#p66286" />
			<content type="html"><![CDATA[<p>Вроде нормально. Получилось безопасно, спасибо</p>]]></content>
			<author>
				<name><![CDATA[D_Pavel]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27294</uri>
			</author>
			<updated>2012-11-29T09:52:47Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=66286#p66286</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Как определить можно-ли безопасно извлечь флэшку?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=66285#p66285" />
			<content type="html"><![CDATA[<p>Если это извлечение диска, как если в Мой компьютер правой кнопкой по букве диска, то это опасное извлечение, могут файлы не записаться, если я не ошибаюсь... Надо попробовать</p>]]></content>
			<author>
				<name><![CDATA[D_Pavel]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27294</uri>
			</author>
			<updated>2012-11-29T09:51:39Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=66285#p66285</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Как определить можно-ли безопасно извлечь флэшку?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=66284#p66284" />
			<content type="html"><![CDATA[<p><a href="http://l.autohotkey.net/docs/commands/Drive.htm"><strong>Drive</strong></a><br />Ejects/retracts the tray in a CD or DVD drive, or sets a drive&#039;s volume label. </p><p>The following is an alternate ejection method that also works on types of media/devices other than CD/DVD:</p><div class="codebox"><pre><code>; Update the first line below to match the desired drive letter (you can ignore all the other lines below).
Driveletter = I:  ; Set this to the drive letter you wish to eject.

hVolume := DllCall(&quot;CreateFile&quot;
    , Str, &quot;\\.\&quot; . Driveletter
    , UInt, 0x80000000 | 0x40000000  ; GENERIC_READ | GENERIC_WRITE
    , UInt, 0x1 | 0x2  ; FILE_SHARE_READ | FILE_SHARE_WRITE
    , UInt, 0
    , UInt, 0x3  ; OPEN_EXISTING
    , UInt, 0, UInt, 0)
if hVolume &lt;&gt; -1
{
    DllCall(&quot;DeviceIoControl&quot;
        , UInt, hVolume
        , UInt, 0x2D4808   ; IOCTL_STORAGE_EJECT_MEDIA
        , UInt, 0, UInt, 0, UInt, 0, UInt, 0
        , UIntP, dwBytesReturned  ; Unused.
        , UInt, 0)
    DllCall(&quot;CloseHandle&quot;, UInt, hVolume)
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[ypppu]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=5974</uri>
			</author>
			<updated>2012-11-29T09:37:28Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=66284#p66284</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Как определить можно-ли безопасно извлечь флэшку?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=66283#p66283" />
			<content type="html"><![CDATA[<p>Классная прога, почти то что нужно! Найти бы подобную команду встронную в виндовс...</p>]]></content>
			<author>
				<name><![CDATA[D_Pavel]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27294</uri>
			</author>
			<updated>2012-11-29T09:32:11Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=66283#p66283</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Как определить можно-ли безопасно извлечь флэшку?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=66282#p66282" />
			<content type="html"><![CDATA[<p>Есть <a href="http://www.websofthelp.ru/infchan/227-bezopasnoe-izvlechenie.html">такая штука</a>. Извлекает устройство по нажатию горячей клавиши или через командную строку.</p>]]></content>
			<author>
				<name><![CDATA[ypppu]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=5974</uri>
			</author>
			<updated>2012-11-29T09:06:26Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=66282#p66282</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Как определить можно-ли безопасно извлечь флэшку?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=66281#p66281" />
			<content type="html"><![CDATA[<p>Нашел такую команду, только она выводит окно с выбором устройства: rundll32 shell32.dll,Control_RunDLL hotplug.dll<br />А нужно чтобы указать сразу какое извлечь, без выбора.</p>]]></content>
			<author>
				<name><![CDATA[D_Pavel]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27294</uri>
			</author>
			<updated>2012-11-29T08:51:29Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=66281#p66281</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Как определить можно-ли безопасно извлечь флэшку?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=66280#p66280" />
			<content type="html"><![CDATA[<p>В общем не важно кто держит флэшку, главное чтобы запись на нее завершилась. Если открыт какой-то файл на чтение, ошибки не возникнет.<br />Но на самом деле ее никто не держит, только если не нажать &quot;Извлечь флэшку&quot;, то запись может быть отложена на неопределенное время, и приходится ждать дольше чем если нажать &quot;Извлечь флэшку&quot;.<br />Вопрос: Как программно извлечь? Желательно не тыкая мышкой по координатам, а командой.</p>]]></content>
			<author>
				<name><![CDATA[D_Pavel]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27294</uri>
			</author>
			<updated>2012-11-29T08:48:55Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=66280#p66280</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Как определить можно-ли безопасно извлечь флэшку?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=66279#p66279" />
			<content type="html"><![CDATA[<p>Судя по описанию, WinAMP держит флешку. Чтобы безопасно её извлечь, нужно завершить/убить соответствующий процесс. То же самое, возможно, придётся проделать с exlorer.exe.<br />Хотя, если я верно понял <a href="http://www.transl-gunsmoker.ru/2012/02/blog-post_18.html">эту статью</a>, всё может быть сложнее.</p>]]></content>
			<author>
				<name><![CDATA[ypppu]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=5974</uri>
			</author>
			<updated>2012-11-29T08:33:42Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=66279#p66279</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[AHK: Как определить можно-ли безопасно извлечь флэшку?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=66277#p66277" />
			<content type="html"><![CDATA[<p>Как сделать чтобы узнать что на флэшку в данный момент всё записалось и теперь можно вырубить комп?<br />Я так предполагаю это равносильно дождаться когда возможно безопасное извлечение. Можно дать команду на извлечение, на экране должно появиться соответствующее сообщение Windows. Тогда можно вырубать, только как дать эту команду из AHK?<br />Или какие есть еще варианты?</p><p>Более подробно опишу ситуацию, можно не читать: На флэшке записана музыка, программа WinAMP и ее файлы настроек. Перед выключением компа я запускаю скрипт выхода из винампа, он сохраняет свои настройки (текущий трек + что-то еще), и обычно приходится ждать достаточно долго, иначе при включении ОС говорит что флэшку необходимо проверить на ошибки. Нужно чтобы всё записывалось как можно быстрее, и было видно что всё готово. Комп выключается не безопасно, а прекращением подачи питания.</p>]]></content>
			<author>
				<name><![CDATA[D_Pavel]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27294</uri>
			</author>
			<updated>2012-11-29T07:45:35Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=66277#p66277</id>
		</entry>
</feed>
