Eject a Removable USB drive

MRAB google at mrabarnett.plus.com
Mon Mar 9 20:10:05 CET 2009


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



More information about the Python-list mailing list