如何检测 CD/DVD/USB 何时插入或移除并获取驱动器盘符?

发布于 2024-09-17 17:43:54 字数 311 浏览 3 评论 0原文

我想检测何时插入或移除磁盘(CD / DVD)或 USB。

我知道我应该使用 WM_DEVICECHANGE 消息,但我的问题是获取驱动器的卷(字母),我尝试通过 WMI 查询获取它Win32_VolumeChangeEvent 也是如此,但我不能!

有一个示例并且工作正常,我如何通过Delphi做到这一点?

I want to detect when a Disk ( CD / DVD ) or an USB inserted or removed.

I know that I should work with WM_DEVICECHANGE message , but my problem is getting the Volume ( Letter ) of the Drive , I tried to Get it by WMI Query and Win32_VolumeChangeEvent too but I could not!

there is an Example and work fine , how can I do this by Delphi?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

神爱温柔 2024-09-24 17:43:54

对于 CD 插入,您需要 CDEvents: http://www.torry.net/ vcl/filedrv/cd/dtcdevents.zip

工作精美。如果您需要示例代码,请给我发送电子邮件([电子邮件受保护])。

For CD insertions, you want CDEvents: http://www.torry.net/vcl/filedrv/cd/dtcdevents.zip

Works beautifully. E-mail me ([email protected]) if you want sample code.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文