Thanks for the link! That code has got me on the right track. I've
almost got it working with one small kink.

After the code runs my drive still shows up on Windows Explorer but as a
removable drive. If I try to double click on it, it tells me to insert a
disk (see screenshot).

So it seems my code is unmounting my volume, but not the actual device.
Any ideas? I've attached the code I've got so far.

-Kyle Rickey

-----Original Message-----
From: python-list-bounces+kyle.rickey=bakerhughes....@python.org
[mailto:python-list-bounces+kyle.rickey=bakerhughes....@python.org] On
Behalf Of MRAB
Sent: Monday, March 09, 2009 2:10 PM
To: python-list@python.org
Subject: Re: Eject a Removable USB drive

Rickey, Kyle W wrote:
> Hello everyone,
> 
>  
> 
> I would like to be able to eject a usb drive based on drive letter.
I've 
> done a bit of googling and came across the CM_Request_Device_Eject 
> function on MSDN
(http://msdn.microsoft.com/en-us/library/ms790831.aspx)
> 
>  
> 
> However, I am not quite sure how to supply the necessary parameter to 
> the function (dnDevInst).  Does it have anything to do with:
> 
>  
> 
> win32file.GetVolumeNameForVolumeMountPoint("F:\\")
> 
>  
> 
> I'm kind of thinking that I have to get some handle to my removable 
> drive and then go up the device tree using CM_Get_Parent
> 
> (http://msdn.microsoft.com/en-us/library/ms791198.aspx) and then call 
> CM_Request_Device_Eject on the appropriate node.
> 
>  
> 
> I am on the right track with this? Any help would be greatly
appreciated.
> 
This article might help:

http://support.microsoft.com/?scid=kb%3Ben-us%3B165721&x=18&y=13
--
http://mail.python.org/mailman/listinfo/python-list

Attachment: eject.py
Description: eject.py

<<attachment: disk.PNG>>

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to