简体   繁体   English

如何找出usb弹出的存储量与否?

[英]How to find out is storage volume on usb ejected or not?

I have an USB device with CD Drive and storage volume. 我有一个带有CD驱动器和存储卷的USB设备。 I can eject both of them or one by one. 我可以一个接一个地弹出它们。 When I call CreateFileA to obtain handle of ejected volume, it returns a valid handle. 当我调用CreateFileA来获取弹出卷的句柄时,它返回一个有效的句柄。

Have anyone idea, how to detect that volume is not ready for using? 有谁想,如何检测该卷还没有准备好使用?

UDP: I have an application, that can starts when the volume is already ejected. UDP:我有一个应用程序,可以在已经弹出卷时启动。 I want to identify state of the volume, when programm is running 我想在程序运行时识别卷的状态

A message of WM_DEVICECHANGE will notify applications of volume arrival and removal. WM_DEVICECHANGE的消息将通知应用程序卷到达和删除。 Find the dbch_devicetype == DBT_DEVTYP_VOLUME . 找到dbch_devicetype == DBT_DEVTYP_VOLUME

There's an example on msdn. 在msdn上有一个例子

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM