如何可靠地检查 Windows 7 中是否启用了自动播放?
我有一个处理 WM_DEVICECHANGE 的应用程序,并且对 DBT_DEVICEARRIVAL 感兴趣。 当插入新设备时,需要知道是否会弹出自动播放对话框。为了找到答案,我检查了
HKCU 和 HKLM 下SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer
中 NoDriveAutoRun 和 NoDriveTypeAutoRun 的值。 但是,如果用户转到“控制面板 -> 自动播放”并取消选中“对所有媒体和设备使用自动播放”,则自动播放实际上被禁用,但不会设置这些注册表值。在我的测试盒上,默认情况下它们甚至不存在。我相信大多数用户会使用控制面板方法来禁用自动播放,而不是本地组策略编辑器。
所以,我的问题是,复选标记设置是什么(我想是某个注册表值?)。无论我尝试什么,我似乎无法(可靠地)弄清楚自动播放是否已启用。
I have an application that handles WM_DEVICECHANGE, and is interested in DBT_DEVICEARRIVAL.
When a new device is inserted, it needs to know if the AutoPlay dialog will pop-up. In order to find out, I am checking the values of NoDriveAutoRun and NoDriveTypeAutoRun in
SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer
under HKCU and HKLM.
However, if a user goes to the "Control Panel -> AutoPlay" and unchecks "Use AutoPlay for all media and devices", then the AutoPlay is effectively disabled, but those registry values are not set. On my test box they aren't even there by default. And I believe that most users would use the Control Panel approach to disable the AutoPlay, rather than the Local Group Policy Editor.
So, my question is, what is that check mark setting (a registry value somewhere i suppose?). No matter what I try, I can't seem to (reliably) figure out if the AutoPlay is enabled or not.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当启用自动播放时,CD-ROM 驱动器上下文菜单上似乎会出现“自动播放”动词。所以你可以测试一下。
It seems like an "AutoPlay" verb appears on the CD-ROM drive context menu when AutoPlay is enabled. So you could test for that.