如何将文件类型与图标关联起来?
我已经为几个自定义文件类型编写了预览处理程序。默认情况下,这些文件类型没有可以打开它们的应用程序。我想将图标与文件类型相关联,作为它们是自定义的标志。
我尝试在 HKCR\.
中设置 DefaultIcon
的注册表项,但它似乎不起作用,即使在重新启动后也是如此。我从 C# 进行这些注册表修改,并且修改成功。
图标文件只是暂时驻留在 %APPDATA%
中的 ico 文件。我计划添加更多图标,并将它们放入 dll 文件中。我只想在采取后续步骤之前让它发挥作用。
我该如何设置这个图标?
I have written preview handlers for a couple custom file types. These file types don't have an application by default that can open them. I want to associate an icon with the file types as a signifier that they are custom.
I have tried setting a registry entry for DefaultIcon
in HKCR\.<filetype>
, but it doesnt appear to work, even after reboots. I do these registry modifications from C#, and the modifications are successful.
The icon file is simply an ico file residing in %APPDATA%
for the moment. I plan to add a few more icons, and put these in a dll file. I just want to get it to work before I take those next steps.
How can I set this icon?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是一个简单的.REG文件,注册文件扩展名.tj的图标
在Win7上测试
Here is a simple .REG file that registers a icon for the file extension .tj
Tested on Win7
此 MSDN 文章解释如何将自定义图标分配给文件类型
This MSDN article explains how to assign custom icons to file types