ejecting a USB flash drive

I'm developing an application in Visual Basic. It detects when a USB Flash Memory Device is connected (by using a timer that ticks every 5 secs and counts the number of drives on my PC) and copies certain files to the Hard Drive. The files are mostly Flash animations and the application is supposed to start playing the files.

The thing is I need to "eject" the USB Flash Memory from my PC, because if I don't the timer will keep searching for files on the USB drive and copying them once and once again.

Please if someone knows how to "eject" usb drives from a PC with VB.Net 2005 please help me...

neto

[634 byte] By [neto] at [2007-12-24]
# 1

do you mean physically eject or remove from system?

for now, take a look at this, although its in C#

http://www.codeproject.com/useritems/usbeject.asp

ahmedilyas at 2007-8-31 > top of Msdn Tech,Visual Basic,Visual Basic General...
# 2
You can be asked to be informed if a device is plugged into the system, you don't have th poll like that...
PeterRitchie at 2007-8-31 > top of Msdn Tech,Visual Basic,Visual Basic General...
# 3
I mean eject logically form the system, not physically throw away from the USB port.
neto at 2007-8-31 > top of Msdn Tech,Visual Basic,Visual Basic General...