How to register a new icon for a file type NOT associated with an application

0

1

For my filesuffix ".special", I created a new icon and stored it as a file named c:\special.ico.

I also created a new registry value HKEY_CLASSES_ROOT.special\ (Standard) REG_SZ c:\special.ico

After restarting my pc, my file c:\special.ico is listed in the file manager together with the new icon in front of it, but all of my files c:\somefolder\somefilename.special continue to be displayed with the old, default icon.

What do I need to do in order for them to be displayed with the new icon?

MaryL

Posted 2016-09-20T13:11:49.937

Reputation: 11

DefaultIcon has to be defined at Prog ID level. This guide should help. How to Change the Default Icon for a File Type in Windows?

– w32sh – 2016-09-20T17:16:34.767

Don't put (SOLVED) in your title, check the checkmark next to the answer that solved the problem or make your own answer and accept it if you solved it yourself. – Scott Chamberlain – 2016-09-20T20:26:49.430

Pretty harsh that this question has negative points. It's a pretty basic problem a newbie will have with trying this stuff on Windows. The Windows extract icon interface(s) is/are still busted in so many ways and documentation on how it 'really' works is so lacking from Microsoft. In fact, it's fair to say that the 'proper' way to use it - really doesn't exist except for a few explicit ways that Explorer uses internally. They should have dumped it in favour of the newer IThumbnailProvider interface to create icons when they added that with Vista and ditched this broken mess as legacy. – mysticcoder – 2017-09-11T06:54:21.550

Answers

0

It would appear you missed adding the DefaultIcon subkey. Then...

Assign the DefaultIcon subkey a default value of type REG_SZ that specifies the fully qualified path for the file that contains the icon.

From Microsoft Developer Resources - How to Assign a Custom Icon to a File Type

You then have to invoke an icon cache update. Rather than a complete rebuild of the cache, a REFRESH is an easy way to do this by running the following command from the Run dialog.

For Windows 10; ie4uinit.exe -show

For Windows 7 & 8; ie4uinit.exe -ClearIconCache

CharlieRB

Posted 2016-09-20T13:11:49.937

Reputation: 21 303

0

MS documentation is correct, but misses the per-user (UserChoice key) part. If the Userchoice key exists and pointing to a ProgID, that ProgID will be in effect instead of the one in HKCR\ProgID.

If you can post a file type dump for .special extension, someone will be able to help you better. FileTypeDiag is a nice tool that generates a full report.

w32sh

Posted 2016-09-20T13:11:49.937

Reputation: 8 611

0

CharlieRB and w32sh, Thank you! I particularly appreciate w32sh's link to FileTypeDiag, which seems to be a useful tool I hadn't been aware of.

What DOES work is the text in the MS link, but which is not precise enough; the corresponding example is outright misplaced or even wrong.

When you only want a new icon for a new file type (i.e. one that is not yet associated to some application), you do the following in the registry if the suffix / file type is .x and the full path of the (.exe, .ico or other) file containing the icon is c:\y.ico

In HKEY_CLASSES_ROOT

.x (i.e. you create a new key, which you leave blank, don't leave out the dot, it's part of the key name)

.x\DefaultIcon (you create a new subkey DefaultIcon within your new key .x)

with the following value:

(Standard) (type: REG_SZ) c:\y.ico (no double quotes ("") needed)

After either shutting down and restarting your pc down or simply a user logout followed by user login (a mere user change will be as insufficient as a simple "refresh the registry"), you will then see your .x files, in your file manager, together with their new icon from within the y file. (The same is true after changing the icon without changing the icon file name / location, i.e. when you replace the content of the icon file: Then again the new icon will only be visible after a restart or a user-logout-login.)

Cheers!

MaryL

Posted 2016-09-20T13:11:49.937

Reputation: 11