I'm struggling with the icon of my application's document files.
First, I'm registering the file extension:
HKEY_CLASSES_ROOT\.Ext\(default) = AppName
Then I give it a shell open command and a icon:
HKEY_CLASSES_ROOT\[AppName]\shell\open\command\(default)="path\app.exe"
HKEY_CLASSES_ROOT\[AppName]\DefaultIcon\(default)="path\app.exe",0
The icon is displayed in Explorer, but not the original one, instead it displays it on a white sheet:
The left one is the associated file, the right one is the executable.
How do I set the registry entries to get the original icon displayed?
I don't know if DefaultIcon
supports quotes on the path, other than that the registration looks OK.
After writing these entries you should call SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, 0, 0)
so other applications can refresh themselves.
The document icon is generated by the shell (GIL_SIMULATEDOC
) when it cannot find a valid DefaultIcon
entry but it knows which executable it is going to use. This can happen if you use "Open With" to open your file-type when it has no registration.
Try calling SHChangeNotify
and then reboot. If that does not fix it then you should search the registry for your file extension and remove it from Explorers HKCU FileExts
keys and any "auto" entries for your type in HKCR. Clearing the shell iconcache might also help.