<?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=101671&amp;view=findpost&amp;p=772253</guid>
        <pubDate>Fri, 08 Jul 2005 19:48:15 +0000</pubDate>
        <title>Открыть/закрыть CD-Rom одной кнопкой</title>
        <link>https://forum.sources.ru/index.php?showtopic=101671&amp;view=findpost&amp;p=772253</link>
        <description><![CDATA[SCINER: <strong class='tag-b'>Вариант Spawn™Production®</strong><br>
Расположите на форме 1 кнопку.<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">Private Declare Function mciSendString Lib &quot;winmm.dll&quot; _</div><div class="code_line">Alias &quot;mciSendStringA&quot; (ByVal lpstrCommand As String, _</div><div class="code_line">ByVal lpstrReturnString As String, ByVal uReturnLength As Long, _</div><div class="code_line">ByVal hwndCallback As Long) As Long</div><div class="code_line">Private Declare Sub Sleep Lib &quot;kernel32&quot; (ByVal dwMilliseconds As Long)</div><div class="code_line">Private Sub OpenCloseDoor(strDriveLetter As String, blnDoOpen As Boolean)</div><div class="code_line">Dim AliasName$, strOpenClose$</div><div class="code_line">strOpenClose = IIf(blnDoOpen, &quot;Open&quot;, &quot;Closed&quot;)</div><div class="code_line">AliasName = &quot;Laufwerk&quot; &amp; strDriveLetter</div><div class="code_line">mciSendString &quot;Open &quot; &amp; strDriveLetter &amp; &quot;: Alias &quot; &amp; AliasName &amp; &quot; Type CDAudio&quot;, 0, 0, 0</div><div class="code_line">mciSendString &quot;Set &quot; &amp; AliasName &amp; &quot; Door &quot; &amp; strOpenClose, 0, 0, 0</div><div class="code_line">End Sub</div><div class="code_line">&nbsp;</div><div class="code_line">Private Sub d_Click()</div><div class="code_line">Dim t As Long</div><div class="code_line">t = Timer</div><div class="code_line">OpenCloseDoor &quot;f:\&quot;, True</div><div class="code_line">Sleep 100</div><div class="code_line">Debug.Print Timer - t</div><div class="code_line">If Timer - t &#60; 1 Then</div><div class="code_line">OpenCloseDoor &quot;f:\&quot;, False</div><div class="code_line">Else</div><div class="code_line">OpenCloseDoor &quot;f:\&quot;, True</div><div class="code_line">End If</div><div class="code_line">End Sub</div><div class="code_line">&nbsp;</div><div class="code_line">Private Sub Command1_Click()</div><div class="code_line">d_Click</div><div class="code_line">End Sub</div></ol></div></div></div></div><script>preloadCodeButtons('1');</script><br>
<br>
<strong class='tag-b'>Вариант maxim84_</strong><div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">Option Explicit</div><div class="code_line">&nbsp;</div><div class="code_line">Const SHGFI_ICONLOCATION = &amp;H1000</div><div class="code_line">Const MB_ICONASTERISK = &amp;H40&amp;</div><div class="code_line">Const MB_ICONEXCLAMATION = &amp;H30&amp;</div><div class="code_line">Const MAX_PATH = 260</div><div class="code_line">&nbsp;</div><div class="code_line">Private Declare Function GetLogicalDrives Lib &quot;kernel32&quot; () As Long</div><div class="code_line">Private Declare Function GetCommandLine Lib &quot;kernel32&quot; Alias &quot;GetCommandLineA&quot; () As Long</div><div class="code_line">Private Declare Function lstrlen Lib &quot;kernel32&quot; Alias &quot;lstrlenA&quot; (ByVal lpString As Long) As Long</div><div class="code_line">Private Declare Function GetDriveType Lib &quot;kernel32&quot; Alias &quot;GetDriveTypeA&quot; (ByVal nDrive As String) As Long</div><div class="code_line">&nbsp;</div><div class="code_line">Private Declare Function mciSendString Lib &quot;winmm.dll&quot; Alias &quot;mciSendStringA&quot; (ByVal lpstrCommand As String, _</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ByVal lpstrReturnString As String, _</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ByVal uReturnLength As Long, _</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ByVal hwndCallback As Long) As Long</div><div class="code_line">Private Declare Sub Sleep Lib &quot;kernel32&quot; (ByVal dwMilliseconds As Long)</div><div class="code_line">Const EndPath = &quot;:\&quot;</div><div class="code_line">Dim Key As Long</div><div class="code_line">&nbsp;</div><div class="code_line">Private Sub OpenCloseDoor(strDriveLetter As String, blnDoOpen As Boolean)</div><div class="code_line">&nbsp;&nbsp;Dim AliasName$, strOpenClose$</div><div class="code_line">&nbsp;&nbsp;strOpenClose = IIf(blnDoOpen, &quot;Open&quot;, &quot;Closed&quot;)</div><div class="code_line">&nbsp;&nbsp;AliasName = &quot;Laufwerk&quot; &amp; strDriveLetter</div><div class="code_line">&nbsp;&nbsp;mciSendString &quot;Open &quot; &amp; strDriveLetter &amp; &quot;: Alias &quot; &amp; AliasName &amp; &quot; Type CDAudio&quot;, 0, 0, 0</div><div class="code_line">&nbsp;&nbsp;mciSendString &quot;Set &quot; &amp; AliasName &amp; &quot; Door &quot; &amp; strOpenClose, 0, 0, 0</div><div class="code_line">End Sub</div><div class="code_line">&nbsp;</div><div class="code_line">Private Sub Command1_Click()</div><div class="code_line">&nbsp;d_Click</div><div class="code_line">End Sub</div><div class="code_line">Private Sub d_Click()</div><div class="code_line">&nbsp;Dim t As Long</div><div class="code_line">&nbsp;&nbsp;t = Timer</div><div class="code_line">&nbsp;&nbsp;OpenCloseDoor Combo1.List(Combo1.ListIndex) &amp; EndPath, True</div><div class="code_line">&nbsp;&nbsp;Sleep 100</div><div class="code_line">&nbsp;&nbsp;If Timer - t &#60; 1 Then</div><div class="code_line">&nbsp;&nbsp; OpenCloseDoor Combo1.List(Combo1.ListIndex) &amp; EndPath, False</div><div class="code_line">&nbsp;&nbsp;Else</div><div class="code_line">&nbsp;&nbsp; OpenCloseDoor Combo1.List(Combo1.ListIndex) &amp; EndPath, True</div><div class="code_line">&nbsp;&nbsp;End If</div><div class="code_line">End Sub</div><div class="code_line">&nbsp;</div><div class="code_line">Private Sub Form_Load()</div><div class="code_line">&nbsp;&nbsp; &nbsp;Dim LDs As Long, Cnt As Long, sDrives As String</div><div class="code_line">&nbsp;&nbsp; &nbsp;LDs = GetLogicalDrives</div><div class="code_line">&nbsp;&nbsp; &nbsp;For Cnt = 0 To 25</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;If (LDs And 2 ^ Cnt) &#60;&#62; 0 Then</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;If GetDriveType(Trim$(sDrives &amp; Chr$(65 + Cnt) &amp; EndPath)) = 5 Then</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Combo1.AddItem sDrives &amp; Chr$(65 + Cnt)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;End If</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;End If</div><div class="code_line">&nbsp;&nbsp; &nbsp;Next Cnt</div><div class="code_line">&nbsp;&nbsp; &nbsp;Combo1.ListIndex = 0</div><div class="code_line">End Sub</div></ol></div></div></div></div>]]></description>
        <author>SCINER</author>
        <category>Работа с аппаратурой</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=101671&amp;view=findpost&amp;p=772248</guid>
        <pubDate>Fri, 08 Jul 2005 19:37:17 +0000</pubDate>
        <title>Открыть/закрыть CD-Rom одной кнопкой</title>
        <link>https://forum.sources.ru/index.php?showtopic=101671&amp;view=findpost&amp;p=772248</link>
        <description><![CDATA[Pr0[)&#33;9Y: <div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">Private Declare Function mciSendString Lib &quot;winmm.dll&quot; _</div><div class="code_line">Alias &quot;mciSendStringA&quot; (ByVal lpstrCommand As String, _</div><div class="code_line">ByVal lpstrReturnString As String, ByVal uReturnLength As Long, _</div><div class="code_line">ByVal hwndCallback As Long) As Long</div><div class="code_line">Private Sub OpenCloseDoor(strDriveLetter As String, blnDoOpen As Boolean)</div><div class="code_line">Dim AliasName$, strOpenClose$</div><div class="code_line">strOpenClose = IIf(blnDoOpen, &quot;Open&quot;, &quot;Closed&quot;)</div><div class="code_line">AliasName = &quot;Laufwerk&quot; &amp; strDriveLetter</div><div class="code_line">mciSendString &quot;Open &quot; &amp; strDriveLetter &amp; &quot;: Alias &quot; &amp; AliasName &amp; &quot; Type CDAudio&quot;, 0, 0, 0</div><div class="code_line">mciSendString &quot;Set &quot; &amp; AliasName &amp; &quot; Door &quot; &amp; strOpenClose, 0, 0, 0</div><div class="code_line">End Sub</div><div class="code_line">&nbsp;</div><div class="code_line">Private Sub Command1_Click()</div><div class="code_line">Dim t As Long</div><div class="code_line">t = Timer</div><div class="code_line">OpenCloseDoor &quot;f:\&quot;, True</div><div class="code_line">If Timer - t &#60; 1 Then OpenCloseDoor &quot;f:\&quot;, False</div><div class="code_line">End Sub</div></ol></div></div></div></div>]]></description>
        <author>Pr0[)&#33;9Y</author>
        <category>Работа с аппаратурой</category>
      </item>
	
      </channel>
      </rss>
	