Friday, 22 April 2011

How to change the icon of a specific extention programmicaly?


In Windows, file extensions and their associated icons and programs are stored in the Registry: HKEY_CLASSES_ROOT\ for system-wide associations.

Starting with Windows XP, there's also HKEY_CURRENT_USER\Software\Classes\ for the current user's file associations, but so far it's rarely used.

For example, if you want to change the information for .txt, you would first check the default value HKEY_CLASSES_ROOT\.txt\ (in my system it's txtfile), and then again go to the matching key in HKEY_CLASSES_ROOT — in this example, it would be HKEY_CLASSES_ROOT\txtfile\DefaultIcon