windows explorer - custom icon for each file?
I'm just curio开发者_如何转开发us about this, as it's probably too much trouble to be worth it for me. I'm wondering how it's possible to have each file of a custom type have a different, descriptive icon in windows explorer. A classic example it Photoshop's .psd files. Windows doesn't natively have a clue what a psd is (I assume?), but somehow, when browsing in Windows, the file icon is a thumbnail of the psd itself.
How is this done? I'm curious both from a programming perspective and OS perspective. For example, when Windows sees .psd, what does it do to get the thumbnail? Does Adobe install some separate utility in a magic location that Windows uses to generate the thumbnail for the file?
This is done via Shell Extension Handlers , to see how its done , see Creating Icon Handlers .
It's done with something called a shell extension. In the case of the .psd files Photoshop probably installs a small DLL which is loaded by the shell to display the thumbnails on demand. The shell extension knows how to read the .psd file to get a thumbnail which may even have been stored in the file when it was saved as an optimisation.
精彩评论