Introduction
I was working on a Shell Extension COM project which wanted the IExtractIcon
to be fed, and because it was over FTP I had a problem fetching icons to get a nice GUI. That's why I looked in CP for a solution but found none. So I developed my own approach to this task and now I think it is an interesting piece of code.
Use of the class
IconExtractor
has two important functions:
SetExtension( LCPSTR psz);//for which extension to search
GetIcon();//get the HICON for drawing
Make sure that you only create new instances if you need them.
Conclusion
The code will get you an Icon from a file extension while looking up in the Registry. Because of the need for special functions to get the icon using the extension, making an array of extensions and a doing lookup of it could/should be interesting.