How to determine when a CD / DVD / USB is inserted or removed and get a drive letter?

I want to determine when a disc (CD / DVD) or USB is inserted or removed.

I know that I need to work with the WM_DEVICECHANGE message, but my problem is getting the volume (letter) in Drive, I tried to get it using WMI Query and Win32_VolumeChangeEvent too, but I could not!

there is an example and it works great, how can I do this with Delphi?

+4
source share
2 answers

To insert a CD, you want the CDEvents: http://www.torry.net/vcl/filedrv/cd/dtcdevents.zip

It works great. Send me an email ( eknowles@gmail.com ) if you want to use the sample code.

0
source

All Articles