Results 1 to 3 of 3

Thread: Two simple question???

  1. #1

    Thread Starter
    Member
    Join Date
    Jun 2000
    Location
    Posts
    52

    Unhappy

    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
    Marci Sarwan

  2. #2
    Guest
    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]

  3. #3
    Lively Member
    Join Date
    May 1999
    Location
    KC
    Posts
    72
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width