-
Hi everyone,
I was wondering if someone out there would be kind enough to help me with two questions.
1. How do you detect the CD ROM drive? I'm writing a program that reads from a CD and the problem I'm running
into is determining which letter the CD ROM drive is map to. For example, on my computer the CD ROM is map to the
letter "D" and on another it is "E".
2. I have a textbox in my program and when the user is
finished entering something in the textbox and press "ENTER" I want it to execute some subroutine. How do you
capture that event? Thanks!
Marci
-
you can do this
Code:
Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
Select Case KeyCode
Case vbKeyReturn
' code here
End Select
End Sub
or this
Code:
Private Sub Text1_KeyPress(KeyAscii As Integer)
Select Case KeyAscii
Case vbKeyReturn
' code here
End Select
End Sub
[Edited by denniswrenn on 06-29-2000 at 12:18 PM]
-
For Question 1:
You can use the GetDriveType API:
Code:
Private Declare Function GetDriveType Lib "kernel32" Alias "GetDriveTypeA" (ByVal nDrive As String) As Long
Private Sub Command1_Click()
If GetDriveType("D:\") = 5 Then
'D is CDRom
ElseIf GetDriveType("E:\") = 5 Then
'E is CDRom
Else
'Neither
End If
End Sub
GetDriveType returns these codes:
2 - Removeable
3 - Fixed
4 - Remote
5 - CD Rom
6 - RAM Disk
7 - Unknown