How to know what type of optical media is in the drive using .net
After taking a loo开发者_StackOverflowk at the information available in the WMI I discovered that there was no difference in the listed properties between having a CD R disk inserted or a DVD R inserted so WMI doesn't seem to know this information.
However, in Windows 7 with auto-play turned on it always pops a dialog that knows the media type and even if it is a blank disk. Also Windows explorer knows the difference. Anybody know how to access this information through system calls or directly in .Net (2.0, 3.0, 3.5, or 4.0)
For this you need to access IMAPI v2, for which there is no offical .net warpper.
Heres a link to IMAPI doc.
http://support.microsoft.com/kb/KB932716
Having said that, i've used this before
http://www.vbaccelerator.com/home/net/code/libraries/writing_cds/imapi/article.asp
You'll need the DiscRecorder functiom, and you can download a sample app using this wrapper from the left hand sidebar.
Hope that helps..
精彩评论