When your program starts, take a snapshot of all the storage devices.
You can do this with a timer, every few seconds or so.

If the new snapshot changes from the original, you can call an API to
see if the new device is removable or not. This won't tell you if it's
a USB drive specifically, but for your situation, it may be highly
unlikely people would be connecting additionally floppy drives or
other removable devices.

You could also parse the output of a program called PCI32.exe and
check for new USB devices. PCI32 is free, produces text output only,
and can be called every few seconds (or whatever interval you feel is
appropriate)



Message: 1
Date: Thu, 3 May 2007 08:56:04 +0300
From: "Simon Dahlbacka" <[EMAIL PROTECTED]>
Subject: Re: [python-win32] Help needed : FindWindowEx
To: "Amit Arora" <[EMAIL PROTECTED]>
Cc: Roger Upole <[EMAIL PROTECTED]>, python-win32@python.org
Message-ID:
       <[EMAIL PROTECTED]>
Content-Type: text/plain; charset="iso-8859-1"

On 5/3/07, Amit Arora <[EMAIL PROTECTED]> wrote:
>
>  Exact Requirement :
> Need to write a Python script that keeps on running and when a USB device
> is plugged in , it detects the device and flashes a message on the propt or
> logs it to a file
> do suggest your ideas on this ........
_______________________________________________
Python-win32 mailing list
Python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to