Yeah but this does it from command line and I don't have to fire up the
compiler either <g>.
Thanx for the code though - I'm going to put it through VB6 and see if I
don't find a use for it somewhere else.
Quote:
> "Ned Flanders"
> > Oh COOL - thanks for sharing this link Torgeir! I've been looking for a
> > CD-closer (tons of progs can open the dang thing) for what feels like
eons.
> Form 2 command buttons
> Function Sleep(time)
> Start = Timer
> Do While Timer < Start + time
> DoEvents
> Loop
> End Function
> Private Sub Form_Load()
> SendMCIString "close all", False
> cmdClose.Visible = False
> If (App.PrevInstance = True) Then
> End
> End If
> fCDLoaded = False
> If (SendMCIString("open cdaudio alias cd wait shareable", True) = False)
Then
> End
> End If
> SendMCIString "set cd time format tmsf wait", True
> End Sub
> Private Sub Form_Unload(Cancel As Integer)
> SendMCIString "close all", False
> End Sub
> Private Function SendMCIString(cmd As String, fShowError As Boolean) As
Boolean
> Static rc As Long
> Static errStr As String * 200
> rc = mciSendString(cmd, 0, 0, hWnd)
> If (fShowError And rc <> 0) Then
> mciGetErrorString rc, errStr, Len(errStr)
> MsgBox errStr
> End If
> SendMCIString = (rc = 0)
> End Function
> ' Open CD
> Private Sub cmdopen_Click()
> SendMCIString "set cd door open", True
> cmdClose.Visible = True
> cmdClose.Default = True
> Sleep (0.1)
> SendKeys "{right}"
> cmdOpen.Visible = False
> End Sub
> Private Sub cmdclose_click()
> SendMCIString "set cd door closed", True
> cmdOpen.Visible = True
> cmdClose.Visible = False
> cmdClose.Default = False
> cmdOpen.Default = True
> Unload Me
> End Sub
> Module
> Option Explicit
> Declare Function mciGetErrorString Lib "winmm.dll" Alias
"mciGetErrorStringA" (ByVal dwError As Long, ByVal lpstrBuffer As
Quote:
> String, ByVal uLength As Long) As Long
> Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA"
(ByVal lpstrCommand As String, ByVal
Quote:
> lpstrReturnString As String, ByVal uReturnLength As Long, ByVal
hwndCallback As Long) As Long
Quote:
> --
> Fosco