-
I'm having a problem retrieving the default icon picture on a few file types.
Usually you lookup the file extension (e.g. HKEY_CLASSES_ROOT\.doc) and read the default value.
You then find the key under the HKEY_CLASSES_ROOT with the same value (e.g. HKEY_CLASSES_ROOT\Word.Document.8), and under that key there should be a DefaultIcon key. The default value of the DefaultIcon key should tell you the file where the icon lives and which icon to use (e.g. C:\Program Files\Microsoft Office\Office\Winword.exe,1).
The problem I'm having is that some file types have a %1 stored in the DefaultIcon key. The HKEY_CLASSES_ROOTS\exefile\DefaultIcon and HKEY_CLASSES_ROOTS\visio.drawing.6\DefaultIcon file types are examples of this.
My question is how do you work out the Default Icon, when the DefaultIcon registry setting is set to %1?
Thanks in advanced.
-
I can understand using the file icon in the file for .exe files and .ico files, but I can't understand why Visio.Drawing.8 DefaultIcon default value is set to %1. A .vsd file doesn't have an icon stored in it.
Also if you create a shortcut to a .vsd file, go into properties and click on the Change Icon button, it shows that the selected icon is the 2nd icon in the C:\WINDOWS\SYSTEM\VISSHE32.DLL file.
How does it know this?
:confused:
-
Each document type has an associated application (.exe) .
In each application there may be icon resources embedded into it. These are numbered starting at 0.
This means that if the return from the "associated icon" section of the registry is not a filename then you need to find th eassociated application (.exe) file and then do an ExtractAssociatedIcon() call to get the relevant icon.
This association is the same mechanism as is used to launch an application from it's data file in Explorer.
HTH,
D.
-
How do I get a handle to the 16x16 icon using the ExtractAssociatedIcon API function?
The ExtractIconEx API function has parameters which are used to return handles to the 32x32 icon and the 16x16 icon.