Eject a Removable USB drive

Rickey, Kyle W Kyle.Rickey at bakerhughes.com
Mon Mar 9 14:39:17 EDT 2009


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.

 

-Kyle Rickey

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20090309/671c115a/attachment.html>


More information about the Python-list mailing list