Indigo Rose Software

Professional Software Development Tools

 
Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2006
    Posts
    13

    Peekaboo! Check to see if CD is in Drive?

    Hi all, hope the year is going well so far!



    I've made a group of discs that have video tutorials on them,
    when you insert a disc it is recognised through the setting and
    checking of registry keys. The discs option allows the user to
    create a short cut link to the cd on the desktop (which copies a small
    program to the harddrive and then creates a shortcut to the desktop).

    The user double clicks the shortcut it access the cd-rom drives
    to see if the disk is in one of the drives set it the Registry!

    Problem:-

    This all works fine, but i have been trying to add the function that check if there is a CD in the drive first, due to the fact my program does find the drive, asks for the disk, but sometimes get stuck in a loop, because it then calls the .exe on the disc to early.


    Q.
    So i want to know: how can i check to see if there is a Disc in the drive before executing the program that is on the disc?

    I've seen that this can be acheived through calling a DLL function in Kernel32 , "GetVolumeInformation", but is
    it there some other way, i m having trouble working out the parameters in
    this DLL Call!

    Hope someone can help!

  2. #2
    Join Date
    May 2006
    Posts
    5,380
    i beleave it is possable with the Drive.GetInformation function,

    from the manual:
    Returns A table containing the specified drive's information, indexed by the following keys:

    Note: If the target drive is a CD-ROM drive or floppy drive, there must be a disk in the drive for this action to work. If there is no disk in the drive, nil is returned.

    Label
    string
    The volume label of the drive. You can access this value using tb.Label.

    FileSystem
    string
    The type of file system on the drive. For example, "FAT32", "NTFS", etc. You can access this value using tb.FileSystem.

    SerialNumber
    number
    The drive's serial number. You can access this value using tb.SerialNumber.

    DisplayName
    string
    The description of the drive as it appears in Windows Explorer's My Computer view. You can access this value using tb.DisplayName.

    i beleave in your case you could use something like this (this is untested code, im just pointing you in the right direction)
    tDriveInfo = Drive.GetInformation("your_target_drive");
    if tDriveInfo.DisplayName == "your_disk_name" then
    --run the file
    end
    Open your eyes to Narcissism, Don't let her destroy your life!!

  3. #3
    Join Date
    Nov 2006
    Posts
    13

    Wink

    Yes, i had been looking at this method for a long time,

    i think i did some early tests but didn't get the information i was
    after even with using .DisplayName.

    but now i have most of the registry keys in place i will
    give it another shot!!

    Thanks RizlaUK!


Similar Threads

  1. Example: Drive Check Utility and USB Key
    By Roboblue in forum AutoPlay Media Studio 7.5 Examples
    Replies: 3
    Last Post: 02-28-2007, 07:54 AM
  2. Can APMS6 check if a USB Drive is present?
    By harrismail in forum AutoPlay Media Studio 6.0
    Replies: 1
    Last Post: 07-05-2006, 03:04 PM
  3. Intranet shared drive access
    By mafranks in forum AutoPlay Media Studio 5.0
    Replies: 7
    Last Post: 10-15-2004, 04:17 AM
  4. Determining the Drive Letter of the Primary Hard Drive
    By Desmond in forum AutoPlay Media Studio 5.0 Examples
    Replies: 0
    Last Post: 10-03-2003, 09:43 AM
  5. Check Free Hard Drive Space???
    By bickallen in forum AutoPlay Menu Studio 3.0
    Replies: 0
    Last Post: 01-31-2002, 09:07 AM

Posting Permissions

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