How to determine if a CD is in a CD-ROM

I was wondering if there is a Windows API that can tell me if there is an empty CD inside the CD-ROM / DVD-Rom.

I already looked at GetVolumeInformation (), but this only returns information about the real CD-ROM, and not about the media that is inside it if it has a CD or not.

All I'm trying to do is see if there is a disk on disk or not, and return a boolean value.

Thanks for any help

+3
source share
3 answers

Call GetFileAttributes()in the root directory. GetFileAttributes()quite optimized as it is commonly used as checking for the presence of a file or directory.

GetDiskFreeSpace, ( ) .

Shell . SHGetDriveMedia , , GetDriveType().

+1

API- DeviceIoControl, IOCTL_STORAGE_CHECK_VERIFY dwIoControlCode. , i. . , , . DeviceIoControl MSDN.

0
source

Source: https://habr.com/ru/post/1772541/


All Articles