Solved

How to get the cdrom drive letter.

Posted on 1998-06-17
1
135 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 50 total points
Comment Utility
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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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 Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

744 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now