开发者

Windows programming: setting different icons for the different file types handled by your application

How do you go about setting different icons for the different file开发者_如何学Python types handled by your application in Microsoft Windows?

Even just a high-level explanation will help.

Thanks, Dan


Most file associations are defined under HKEY_CLASSES_ROOT. In There, you define a class for each file extension. For example, under HKCR\.txt you'll find txtfile as the default value. If you go to HKCR\txtfile, you'll find all the actions associated with this class, including open under HKCR\txtfile\shell and the icon under HKCR\txtfile\DefaultIcon.

MSDN has some more information.


File extensions and their icons are controlled through the registry

Here's some more info on how to do it with a deployment project, most installers like installshield that's included for free have similar features

http://www.c-sharpcorner.com/uploadfile/scottlysle/customfiletype12082006000848am/customfiletype.aspx


Assign the icons to the files in Windows registry. You can give icons in a dll just like Windows' shell32.dll.


In visual studio

Microsoft use a trick to handle this situation.

he make a dll and he put all icon on them. in system registry he make the rule that how they show the icon for ascx and aspx. he put the file extension as name and icon as value.

when visual studio run visual studio read the system registry and show the icon.

if you don't believe this you can read this in your regedit if you have visual studio in your system.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜