Finding default CD-Rom.......

Ok, I made a splash screen for my CD-ROM (Autorun.exe and Autorun.inf).
7 seconds after the splash screen a menu that i created opens up with
all the programs on the CD. For each program i made a button,
in that button i wrote:

Shell "G:\Adobe\Acrobat4readerdemo\Setup.exe"

(that was just an example)
So when i click on the button, it opens up the installion program for
that app on that cd, that is located in Drive G:\, on my computer.!

Now the problem is this:  when i insert the cd into a different
computer, the menu with all the buttons doesn't work, because when i
created the button, the shell command refered to the exe that was on
drive G:\ (located on my pc).  The people that i'm going to be giving
out the cd with my family photos to will have different cd-rom driver
letters and i won't know what there's is going to be
(cd-rom driver letter).  

Question:  How do i make the shell command read the setup.exe that is
located in the folder Adobe\Acrobat\ on the CD-ROM that my disc is in?
Or is there some other command that allows me to do that?  
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Hi jaksenov,
      Private Const DRIVE_CDROM = 5
      Private Const DRIVE_FIXED = 3
      Private Const DRIVE_RAMDISK = 6
      Private Const DRIVE_REMOTE = 4
      Private Const DRIVE_REMOVABLE = 2
      Private Const DRIVE_UNKNOWN = 0    'Unknown, or unable to be determined.

      Public Declare Function GetDriveTypeA Lib "kernel32" _
 (ByVal nDrive As String) As Long

Public Function CDletter() As String

    Dim x As String
    Dim c As Integer
    For c = 0 To 25
        x = Chr(Asc("a") + c) & ":\"
        If GetDriveTypeA(x) = DRIVE_CDROM Then
            CDletter = x
            Exit Function
        End If

End Function

      Public Function DriveType(sDrive As String) As String
         ' Returns the drive type if possible.
         Dim lRet As Long

         lRet = GetDriveTypeA(sDrive & ":\")
         Select Case lRet
            Case 0
               'DriveType = "Cannot be determined!"
               DriveType = "Unknown"

            Case 1
               'DriveType = "The root directory does not exist!"
               DriveType = "Unknown"
            Case DRIVE_CDROM:
               DriveType = "CD-ROM Drive"

            Case DRIVE_REMOVABLE:
               DriveType = "Removable Drive"

            Case DRIVE_FIXED:
               DriveType = "Fixed Drive"

            Case DRIVE_REMOTE:
               DriveType = "Remote Drive"
         End Select

      End Function

      Public Function GetDriveType(sDrive As String) As Long

         Dim lRet As Long
         lRet = GetDriveTypeA(sDrive & ":\")

         If lRet = 1 Then
            lRet = 0
         End If

         GetDriveType = lRet

      End Function


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jaksenovAuthor Commented:
setiawan, thank u so much for that code.
I will defenatly use it, but i also found a much easerier code:
Private Sub Command1_Click()
Shell Left(App.Path,1) _ & ":\whatever\Setup.exe"
End Sub

In your code where do i put in the path of the setup.exe?
Well thanks for the help danny!

here is my e-mail
Hi jaksenov,

the code is only search which drive letter is CD-ROM drive.

function CDletter will return what you need

jaksenovAuthor Commented:
Ohh ok, Thanks Setiawan.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.