|
-
Feb 2nd, 2001, 08:31 PM
#1
Thread Starter
Addicted Member
Bah, what's the API call that ejects/pulls in the CD Rom's drive? I've had it before but I can't remember.
Stephen Haney- 115 116 101 118 101 31 72 65 78 69 89
-ShardsOfSilence.net- ^ My name in ASCII ^
You forget something new every day
| WinME | VB6 Pro | MSC++ | Lambda MOO |
-
Feb 2nd, 2001, 08:39 PM
#2
_______
<?>
Code:
'Open and close the cd door
Option Explicit
Declare Function mciSendString Lib "winmm.dll" Alias _
"mciSendStringA" (ByVal lpstrCommand As String, ByVal _
lpstrReturnString As String, ByVal uReturnLength As Long, _
ByVal hwndCallback As Long) As Long
'===============================================================
'To open the CD door, use this code:
retvalue = mcisendstring("set CDAudio door open", _
returnstring, 127, 0)
'To close the CD door, use this code:
retvalue = mcisendstring("set CDAudio door closed", _
returnstring, 127, 0)
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
Feb 3rd, 2001, 12:03 AM
#3
Lively Member
The code listed above didn't work for me but this code does:
Code:
Option Explicit
Private Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA" (ByVal lpstrCommand As String, ByVal lpstrReturnString As String, ByVal uReturnLength As Long, ByVal hwndCallback As Long) As Long
Private Sub CloseCDDoor(ByVal DriveLetter As String)
'This will close the specified cd-rom drive. e.g. Call CloseCDDoor("e")
Dim AliasName As String
AliasName = "Drive" & DriveLetter
mciSendString "open " & DriveLetter & ": Alias " & AliasName _
& " Type CDAudio", 0, 0, 0
mciSendString "Set " & AliasName & " door Closed", 0, 0, 0
End Sub
Private Sub OpenCDDoor(ByVal DriveLetter As String)
'This will open the specified cd-rom drive. e.g. Call OpenCDDoor("e")
Dim AliasName As String
AliasName = "Drive" & DriveLetter
mciSendString "eject " & DriveLetter & ": Alias " & AliasName _
& " Type CDAudio", 0, 0, 0
mciSendString "Set " & AliasName & " door open", 0, 0, 0
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|