Results 1 to 5 of 5

Thread: Getting Disk Label from DVD-Drive

Threaded View

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2002
    Posts
    269

    Getting Disk Label from DVD-Drive

    Hi,

    I have been using this code for some time to get the name of the currenty disk in the DVD-Drive.

    VB Code:
    1. Dim VI As VolumeInfo
    2. 'getVolumeInfo
    3. Private Type VolumeInfo
    4.         Serial As Long
    5.         VolumeName As String
    6.         FileSystemName As String
    7. End Type
    8.  
    9.  
    10. Private Function GetVolumeInfo(Drive As String) As VolumeInfo
    11. Dim tmp As VolumeInfo
    12. tmp.VolumeName = Space(255)
    13. tmp.FileSystemName = Space(255)
    14.     GetVolumeInformation Drive & ":\", tmp.VolumeName, 255, tmp.Serial, 0, 0, tmp.FileSystemName, 255
    15.  
    16. tmp.VolumeName = Trim(tmp.VolumeName)
    17. tmp.FileSystemName = Trim(tmp.FileSystemName)
    18. GetVolumeInfo = tmp
    19. End Function

    Then to put the actual disk label into a text box I have...

    VB Code:
    1. vi2 = GetVolumeInfo(letter)
    2. Text23 = vi2.VolumeName

    It works and I put the above two lines into a timer in order to get the text box updated. However no matter how fast I set the timer, like 100ms, 200ms, 500ms, there is always a massive delay.

    Eg. Say I have AMERICAN PIE in at the minute. My text box shows it fine. Now I eject the tray and the text box will stay saying AMERICAN PIE for about 8 seconds. The whole program seems to freeze up for those few seconds.

    Has anyone got any better code for getting the disk name. Looking in "MY COMPUTER", windows updates the disk name in a split second.

    Any help would be greatly appreciated. I tried using windows own code to get notified when a disk was inserted but I couldn't get it to work if my program wasn't focused.

    Thanks!!!!!!
    KT
    Last edited by King_Tweaker; Jun 10th, 2003 at 01:59 PM.

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