[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

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

Posted on 1999-12-09
4
Medium Priority
?
132 Views
Last Modified: 2010-05-18
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?  
0
Comment
Question by:jaksenov
  • 2
  • 2
4 Comments
 
LVL 6

Accepted Solution

by:
setiawan earned 800 total points
ID: 2270775
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
         
    Next
         

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

  danny
0
 

Author Comment

by:jaksenov
ID: 2270919
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
jaksenov@home.com
0
 
LVL 6

Expert Comment

by:setiawan
ID: 2270978
Hi jaksenov,

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

function CDletter will return what you need

 danny
0
 

Author Comment

by:jaksenov
ID: 2271865
Ohh ok, Thanks Setiawan.
0

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month7 days, 13 hours left to enroll

608 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