CD Insert Notification in WinXP

T

Tim O'Connell

Hi,

I'm using Python 2.3 on a Win XP box, and I'm trying to find if there's
a library of some sort that will give you a callback (or something
comparable) when a new disc is inserted into a CD Rom drive. I've done a
little googling and nothing's come up, so I'm not holding my breath. :)

If not, I'm thinking of implementing a thread to periodically read the
volume serial number using GetVolumeInformation from Mark Hammond's Win
32 extensions, then doing a compare against the last known value. Does
this sound "sane"? Any recommendations would be useful.

Thanks!
Tim
 
J

Josiah Carlson

I'm using Python 2.3 on a Win XP box, and I'm trying to find if there's
a library of some sort that will give you a callback (or something
comparable) when a new disc is inserted into a CD Rom drive. I've done a
little googling and nothing's come up, so I'm not holding my breath. :)

If not, I'm thinking of implementing a thread to periodically read the
volume serial number using GetVolumeInformation from Mark Hammond's Win
32 extensions, then doing a compare against the last known value. Does
this sound "sane"? Any recommendations would be useful.

Tim,

Generally, Windows autoinsert notification can be enabled or disabled
for data and audio disks independantly. When autoinsert notification is
enabled on data disks, the Windows operating system automatically does
what CD:\autorun.inf says.

I would imagine that a similar thing occurs on audio cd inserts, except
that it automatically calls the program that is associated with .cda
files.

Certainly there are hooks into the OS that allow one to intercept
filesystem read/write calls (it is what virus scanners do), which could
be tested to see if the read is from a cdrom drive, but I don't know if
Mark Hammond's extensions would be enough, though it is doubtful.


I would suggest polling the serial number every 5 seconds or so, making
sure to deal with the various exception conditions.

- Josiah
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top