是否可以通过编程将自动播放和 WIA 重置为默认的“询问我?”?

发布于 2024-07-21 22:59:59 字数 313 浏览 4 评论 0原文

我有代码广告自动播放和 WIA 处理程序分别从存储卡和数码相机读取图像文件,并且工作正常。

但是,我想在第一次运行应用程序时将自动播放和 WIA 处理程序重置为默认值“每次都询问我要做什么”。 为什么? 因为如果用户将处理程序设置为其他内容,那么当她/他尝试使用我的应用程序时,他们的机器仍然会执行其他操作,然后他/她会向我抱怨我的应用程序无法工作,而实际上他们的应用程序无法工作机器只是尊重他们之前的设置。

那么有没有办法以编程方式重置自动播放和 WIA 处理程序? 我假设有一些 API 调用(最好是 Win32,而不是 .Net)或可以修改的注册表设置。

I have code that ads both Autoplay and WIA handlers for reading images files from memory cards and digital cameras, respectively, and it works fine.

However, I'd like to reset the Autoplay and WIA handlers to the default of "Ask me what to do every time" the first time my application is run. Why? Because if the user has the handlers set to something else then when s/he tries to use my application, their machine will still do the something else and then s/he will complain to me that my application doesn't work when in fact their machine is simply honoring their previous settings.

So is there any way to reset both Autoplay and WIA handlers programatically? I assume there's either some API call (preferably Win32 and not .Net) or registry setting(s) that can be modified.

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

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

发布评论

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

评论(1

回眸一笑 2024-07-28 22:59:59

看起来每个用户的自动播放首选项(对应于 Windows Vista 和 7 中的自动播放控制面板)保存在 HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\UserChosenExecuteHandlers 下。 每个类别的自动播放设备或媒体类型都有一个子项; 将子项的默认值更改为 MSPromptEachTime 应恢复“每次询问我要做什么”行为。 (虽然自动播放控制面板是 Vista 和 7 中的新功能,但 XP 中存在相同的注册表项,并且对于基于音量的自动播放,我认为它们的工作原理相同。)

这篇 MSDN 文章 详细介绍了自动播放的工作原理。

It looks like the per-user autoplay preferences (what corresponds to the Autoplay control panel in Windows Vista and 7) are kept under HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\UserChosenExecuteHandlers. There's a subkey for each category of autoplay device or media type; changing the subkey's default value to MSPromptEachTime should restore the "Ask me what to do every time" behavior. (Although the Autoplay control panel is new to Vista and 7, the same registry keys exist in XP, and for volume-based autoplay, I think they work the same.)

This MSDN article has more details on how autoplay works.

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