是否有 Windows API 可以修改扩展名的文件类型关联?

发布于 2024-08-04 18:00:31 字数 293 浏览 2 评论 0原文

我正在寻找一种方法来以编程方式调整 Windows 系统上文件关联的细节。例如,针对特定文件类型的“打开”操作的“执行此操作的应用程序用户”设置。

显然,我可以通过直接修改注册表来做到这一点,但如果有一个 API,我更愿意使用它,因为它可能更能适应操作系统处理将扩展映射到应用程序的变化。

出于我的目的,我需要将其写入 VBScript (.VBS) 文件中,因为它是与强制使用它的 VMWare ThinApp 一起使用的包的一部分。不过,本周我将移植/包装/任何我需要做的事情,所以我对任何解决方案持开放态度(包括使用 .NET 框架)

I'm looking for a way to programatically tweak the particulars of a file association on a Windows system. For example, the "Application User to Perform this Action" setting for the "Open" action for a particular file type.

Clearly I could do this by modifying the registry directly, but if there is an API I'd prefer to use that as it would likely be more resilient to changes in the OS handling of mapping extensions to applications.

For my purposes I'm needing to write this in VBScript (.VBS) file because it is part of a package to be used with VMWare ThinApp that mandates it. However, I'll port/wrap/whatever I need to make this week, so I am open to any solution (including using the .NET framework)

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

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

发布评论

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

评论(1

难以启齿的温柔 2024-08-11 18:00:31

Microsoft 文档,创建文件的官方过程关联是通过修改注册表来实现的。您需要调用的唯一其他 API 是 SHChangeNotify,使用 SHCNE_ASSOCCHANGE 来告知正在运行的应用程序关联已更改。

Microsoft documents that the official procedure for creating file associations is through modification of the registry. The only other API you need to call is SHChangeNotify, with SHCNE_ASSOCCHANGE, to tell running applications that associations have changed.

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