安全删除使用Win32 API USB驱动器? [英] Safely remove a USB drive using the Win32 API?

查看:671
本文介绍了安全删除使用Win32 API USB驱动器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何删除使用Win32 API的USB驱动器?我做嵌入式系统大量的工作,对这些我有拷贝在U盘我的程序,并将其插入到目标硬件。

How do I remove a USB drive using the Win32 API? I do a lot of work on embedded systems and on one of these I have to copy my programs on a USB stick and insert it into the target hardware.

由于我主要是在控制台上工作,我不喜欢使用鼠标点击小任务栏图标每天百倍。

Since I mostly work on the console I don't like to use the mouse and click on the small task-bar icon hundred times a day.

我很想写一个小程序做正是这样我就可以把它放到我的makefile,但我还没有发现任何API调用做同样的事情。

I'd love to write a little program to do exactly that so I can put it into my makefiles, but I haven't found any API call that does the same thing.

任何想法?

推荐答案

您可以使用CM_Request_Device_Eject()函数,以及一些其他的可能性。
请参阅下列项目和文章:

You can use the CM_Request_Device_Eject() function as well as some other possibilities. Consult the following projects and articles:

DevEject:简单。
http://www.withopf.com/tool​​s/deveject/

DevEject: Straightforward. http://www.withopf.com/tools/deveject/

一个有用的$ C $的CProject文章:
<一href=\"http://www.$c$cproject.com/KB/system/RemoveDriveByLetter.aspx\">http://www.$c$cproject.com/KB/system/RemoveDriveByLetter.aspx

A useful CodeProject article: http://www.codeproject.com/KB/system/RemoveDriveByLetter.aspx

这篇关于安全删除使用Win32 API USB驱动器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆