识别我使用的媒体SHGetDriveMedia
;在我传递的第二个参数上pdwMediaContent
作为参考,api 插入内容的类型。但是,识别是异步完成的。我怎么知道api什么时候完成了识别?
问问题
274 次
1 回答
4
它不是异步的。当您在将磁盘放入驱动器后立即调用它时,它处于“嗅探阶段”,试图确定应该使用哪种自动播放磁盘的方法。当函数返回时,可以在ARCONTENT标志中返回几个检测阶段:
ARCONTENT_PHASE_UNKNOWN (0x00000000)
Introduced in Windows Vista. AutoPlay is searching the media. The phase of the
search (presniff, sniffing, or final) is unknown.
ARCONTENT_PHASE_PRESNIFF (0x10000000)
Introduced in Windows Vista. The contents of the media are known before the
media is searched, due to the media type; for instance, audio CDs and DVD movies.
ARCONTENT_PHASE_SNIFFING (0x20000000)
Introduced in Windows Vista. AutoPlay is currently searching the media. Any
results reported during this phase should be considered a partial list as more
content types might still be found.
ARCONTENT_PHASE_FINAL (0x40000000)
Introduced in Windows Vista. AutoPlay has finished searching the media. Results
reported are final.
ARCONTENT_PHASE_MASK (0x70000000)
Introduced in Windows Vista. A mask that denotes valid ARCONTENT_PHASE values.
这似乎表明(基于上面的文本ARCONTENT_PHASE_FINAL
)您应该期望需要多次调用此函数,直到您在返回的标志中收到该值,此时您可以检查磁盘标志中的其他值类型。
于 2012-08-01T16:39:22.963 回答