Stuart McLachlan
stuart at lexacorp.com.pg
Sun Mar 21 15:52:30 CST 2004
On 22 Mar 2004 at 7:01, Dean Ellis wrote: > Hi All, > > I'm having some trouble with a database that is required to detect the CD > Drive of the Computer it is running from. The code that is in there works > for Desktop computers, but not Laptops., and even then, this is not garuntee > > > Here is the code on the module: > > Public Function SaveAndGetCDROMDriveLetter() As String > > Dim DriveChar As Byte > Dim tmpDrive As String > Dim CDDRiveLetter As String > > SaveAndGetCDROMDriveLetter = "Unknown" > > On Error GoTo ErrorHandler > > For DriveChar = 0 To 25 > tmpDrive = Chr(65 + DriveChar) & ":\" > If (GetDriveType(tmpDrive) = DRIVE_CDROM) Then > SaveAndGetCDROMDriveLetter = tmpDrive > Exit For One problem with that is many macines today have DVD Drives. A DVD/CD returns DRIVE_FIXED from GetDriveType() Take a look at http://www.vb2themax.com/NLItem.asp?PageID=NewsletterBank&ID=1040 for code to determine all drive info. -- Lexacorp Ltd http://www.lexacorp.com.pg Information Technology Consultancy, Software Development,System Support.