CD Insert Notification in WinXP

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Tim O'Connell

    CD Insert Notification in WinXP

    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 GetVolumeInform ation 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
  • Josiah Carlson

    #2
    Re: CD Insert Notification in WinXP

    > I'm using Python 2.3 on a Win XP box, and I'm trying to find if there's[color=blue]
    > 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 GetVolumeInform ation 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.[/color]

    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

    Comment

    Working...