|
-
January 18th, 2000, 02:06 PM
#1
access files on unknown CD drive
I have a form with 3 buttons that access files on a cd. How do I read files from the cd? Keep in mind I don't know what drive letter the user has assigned to the cd drive and they could have more then one. Hope that makes sense.
-
January 18th, 2000, 03:46 PM
#2
Re: access files on unknown CD drive
You can use a Couple of APIs to determine which Drive is the CDROM, ie.
private Declare Function GetDriveType Lib "kernel32" Alias "GetDriveTypeA" (byval nDrive as string) as Long
private Declare Function GetLogicalDriveStrings Lib "kernel32" Alias "GetLogicalDriveStringsA" (byval nBufferLength as Long, byval lpBuffer as string) as Long
private Const DRIVE_CDROM = 5
Function FindCDROM() as string
Dim sDrives as string
Dim sDrive as string
sDrives = Space(255)
sDrives = Left$(sDrives, GetLogicalDriveStrings(255, byval sDrives))
While InStr(sDrives, "\")
sDrive = Left$(sDrives, InStr(sDrives, "\"))
If GetDriveType(sDrive) = DRIVE_CDROM then
FindCDROM = sDrive
Exit Function
End If
sDrives = mid$(sDrives, len(sDrive) + 2)
Wend
End Function
private Sub Command1_Click()
Debug.print "CDROM is on Drive - " & FindCDROM
End Sub
Aaron Young
Analyst Programmer
[email protected]
[email protected]
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
|