Results 1 to 7 of 7

Thread: Media in the CD rom Drive

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2002
    Location
    Richmond VA
    Posts
    14

    Media in the CD rom Drive

    Hey there, Not even sure if this is the right forum but here it goes.

    I have a program that looks up a file name based on index fields in a database. That part I got to work great. The problem is that the imagefiles are CD's , 50 of them. When the user looks for the image name and double clicks it I got it so that if the right CD is in there, it will open the file in the application with SheelExecute, what I want to know is how can I prompt the user for the correct media?

    My table is as follows

    Box# (index field)
    Folder# (index Field)
    CD
    Image Name

    Any help is appreciated

    Dave

  2. #2
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629
    u want to throw a msgbox at the user until he inserts a cd and its the correct cd ? is that it?
    -= a peet post =-

  3. #3

    Thread Starter
    New Member
    Join Date
    Apr 2002
    Location
    Richmond VA
    Posts
    14
    Yea.. I found the way to detect which drive is the CD rom drive I want to know if there is a way to detect the CD-ROM name in the drive. So if CD1 is in there, and looking for a file on CD35 it will detect that CD1 is in there, throw up a MSGBOX saying put in CD35 and then wait for the CD to be put in.

    Dave

  4. #4
    Lively Member
    Join Date
    Mar 2002
    Posts
    89
    declare a variable of type

    FileSystemObject (include a reference to microsoft scripting runtime )

    Dim fso as new FileSystemObject

    then see the property .drives

    fso.Drives(a_letter_or_a_number).VolumeName

    it will give you the name of the CD ....

    so

    if fso.Drives(a_letter_or_a_number).VolumeName = "CD1" then
    msgbox "This is the right CD"
    else
    msgbox "Wrong, bad CD"
    end if
    BlahDoS . :P

  5. #5
    Hyperactive Member ZeroCool's Avatar
    Join Date
    Feb 2002
    Location
    In front of my computer
    Posts
    423
    Why not check the cd serial?

    VB Code:
    1. Private Declare Function GetVolumeInformation Lib "Kernel32" Alias "GetVolumeInformationA" (ByVal lpRootPathName As String, ByVal lpVolumeNameBuffer As String, ByVal nVolumeNameSize As Long, lpVolumeSerialNumber As Long, lpMaximumComponentLength As Long, lpFileSystemFlags As Long, ByVal lpFileSystemNameBuffer As String, ByVal nFileSystemNameSize As Long) As Long
    2.  
    3. Public Function GetSerial(StrDrive As String) As Long
    4. Dim Serial As Long
    5.  
    6. GetVolumeInformation StrDrive, dummy, 255, Serial, 0, 0, dummy2, 255
    7. GetSerial = Serial
    8. End Function
    Visual Baisc 6 (SP5)
    Windows Xp

  6. #6
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333
    The simplest way (or the most complex way, depending on your point of view) would be to have an Index file on your CD that has the list that can be selected.

    The Index file would know what CD contains that information, and prompt the user appropriately.

  7. #7
    C# Aficionado Lord_Rat's Avatar
    Join Date
    Sep 2001
    Location
    Cave
    Posts
    2,497
    Originally posted by ZeroCool
    Why not check the cd serial?

    VB Code:
    1. Private Declare Function GetVolumeInformation Lib "Kernel32" Alias "GetVolumeInformationA" (ByVal lpRootPathName As String, ByVal lpVolumeNameBuffer As String, ByVal nVolumeNameSize As Long, lpVolumeSerialNumber As Long, lpMaximumComponentLength As Long, lpFileSystemFlags As Long, ByVal lpFileSystemNameBuffer As String, ByVal nFileSystemNameSize As Long) As Long
    2.  
    3. Public Function GetSerial(StrDrive As String) As Long
    4. Dim Serial As Long
    5.  
    6. GetVolumeInformation StrDrive, dummy, 255, Serial, 0, 0, dummy2, 255
    7. GetSerial = Serial
    8. End Function
    I hate when apps use the Serial for a CD because I sometimes will switch CD's during the course of running the app and most of those programs just bomb when I do.
    Need to re-register ASP.NET?
    C:\WINNT\Microsoft.NET\Framework\v#VERSIONNUMBER#\aspnet_regiis -i

    (Edit #VERSIONNUMBER# as needed - do a DIR if you don't know)

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