Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How to get the cdrom drive letter.

Posted on 1998-06-17
1
Medium Priority
?
179 Views
Last Modified: 2010-05-03

I'm looking for a function or method to get the letter of the cdrom drive..
Is there any function or entry in the register??
0
Comment
Question by:ineila
1 Comment
 
LVL 6

Accepted Solution

by:
alamo earned 200 total points
ID: 1463497
I assume you mean for Win95 or NT.

This function returns the CDROM drive letter, or "" if none found:

Private Declare Function GetDriveType Lib "kernel32" Alias _
     "GetDriveTypeA" (ByVal sDrive As String) As Long
Private Const DRIVE_CDROM = 5

Public Function GetCDRomDrive() As String
 Dim i As Integer
 Dim sDrive As String
 GetCDRomDrive = ""      ' in case none found
 For i = 0 To 25
  sDrive = Chr$(i + 64)
  If GetDriveType(sDrive & ":\") = DRIVE_CDROM Then
   GetCDRomDrive = sDrive
   Exit For
  End If
 Next
End Function

Hope this helps, good luck!
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

886 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question