|
-
Feb 28th, 2002, 08:14 AM
#1
Thread Starter
Lively Member
cd tray insert notification
Are there any way to know if there is a disc in the cd/dvd-player without searching for any files? Is there a flag set somewhere in windows when a disc is inserted?
They will try to steal everything you own,
It goes on and on and on...
Pain - On and On
-
Feb 28th, 2002, 08:22 AM
#2
VB Code:
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 Function IsCDInDrive(ByVal strCDDriveLetter As String) As Boolean
Dim strStatus As String * 128
'open the device
mciSendString "open " & strCDDriveLetter & ": type cdaudio alias cddrive wait", vbNullString, 0, 0
'see if there's something in the drive
mciSendString "status cddrive media present", strStatus, Len(strStatus), 0
'close the device
mciSendString "close cddrive", vbNullString, 0, 0
'the string will contain "true" or "false" which can be easily converted
IsCDInDrive = CBool(Left$(strStatus, InStr(strStatus, vbNullChar) - 1))
End Function
-
Feb 28th, 2002, 08:23 AM
#3
-= B u g S l a y e r =-
or u can use FSO
VB Code:
Private Sub Command1_Click()
Dim fso As New FileSystemObject
Dim drv As Drive
Set drv = fso.GetDrive("A:")
If drv.IsReady Then
MsgBox "drive is ready"
Else
MsgBox "drive not ready"
End If
End Sub
-
Feb 28th, 2002, 08:26 AM
#4
Thread Starter
Lively Member
They will try to steal everything you own,
It goes on and on and on...
Pain - On and On
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
|