Results 1 to 3 of 3

Thread: where is the CD-ROM drive?

  1. #1
    Guest
    Take a look at this thread which shows how to determine the Drive letter and if there are any CDs in it.

  2. #2
    Lively Member
    Join Date
    Aug 2000
    Location
    quebec
    Posts
    81

    Cool

    If what you're trying to do - I didn't quite get your point - is trying to find the CD drive
    and it's letter then use WMI:

    Code:
    Public Sub listDrives(Optional strServer As String = ".")
    
        Dim objs As WbemScripting.SWbemObjectSet
        Dim obj As WbemScripting.SWbemObject
        Dim svcs As WbemScripting.SWbemServices
        Dim swLocator As WbemScripting.SWbemLocator
            
        Set swLocator = New WbemScripting.SWbemLocator
        Set svcs = swLocator.ConnectServer(strServer)
        Set objs = svcs.InstancesOf("Win32_LogicalDisk")
    
        For Each obj In objs
          If obj.Properties_.Item("DriveType") = 5 Then
            Debug.Print "Name:  " & obj.Properties_.Item("Name")
            Debug.Print "Drive Type:  " & obj.Properties_.Item("DriveType")
          End If 
        Next obj
    
        Set objs = Nothing
        Set svcs = Nothing
        Set swLocator = Nothing
    End Sub
    Of course you need WMI installed on your sys which is avail. free from microsoft.

    C/C++,Delphi,VB6,Java,PB (blech!),ASP,JSP,SQL...bla bla bla and bla
    I love deadlines. I like the whooshing sound they make as they fly by.
    —Douglas Adams

  3. #3
    Guest

    Thumbs up Creating CDs

    Thanks for the help I wrote the code yesterday from the VBA Developer's Handbook it din't give me the correct results so I modified it with your code. Is there some way to prevent directory browsing on a CD so that an expiration date on the material there will be effective?

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