For a while now I've thought it would be great if the Quit button on the PortableApps menu would also undock the USB key, instead of requiring a couple more clicks, on the Safely Remove Hardware icon, and then on the drive letter - which if there is a few choices can be awkward to work out.
Anyhow, I bumped into some code (while looking for something else) that might be a good starting point if anyone was interested.
http://www.codeproject.com/KB/system/RemoveDriveByLetter.aspx