How do i see if a PC has a CD drive and determine if its a CD drive or a DVD drive?
thanks
Printable View
How do i see if a PC has a CD drive and determine if its a CD drive or a DVD drive?
thanks
Well WMI will pull that info, sort of. The Win32_CDROMDrive WMI class (see my sig for codebank submission on WMI, I think the sample even does the Win32_CDROMDrive class) will pull up both CD and DVD drives, however it will still be reported as a "cd-rom drive". "DVD" will usually pull up in the name (caption) if it is a DVD drive so you could check the name to see if it contains "DVD", but I am not certain that will be the case for all.
Check out post:
http://www.vbforums.com/showthread.p...hlight=Disk+cd
The problem spurred me on to figure out deviceIOControl a bit more...
Briefly...
You can send commands directly to the drive using this api call. The commands are standardised, and the majority of manufacturers stick to the standards.
The standards are available on www.t10.org (mmc3 and spc2 documents).
So to find out what capabilities a drive has, first you send an INQUIRY command to find out the device type. If this comes back with "CDROM/DVD" then we can then send a MODE SENSE command. This one asks the drive to send back a page of information. There are lots of standard pages of information, so we also specify that we want to get the "CD capabilities and mechanical status page".
And that has the info that we need.
It wont work for ancient drives, but with all my drives I could find out if they can read each of cdr, cdrw, dvdrom, dvdr, dvdram and write each of cdr, cdrw, dvdr, dvdram.
When we send the inquiry command, we also get back some id strings, so they are available as properties.
There is other stuff you can do, like find out the type of media in the drive, but my code for it is a complete mess...