Click here to Skip to main content
Licence CPOL
First Posted 21 Nov 2005
Views 29,787
Bookmarked 14 times

Getting Icons of Remote Files

By | 21 Nov 2005 | Article
An easy way to get the icons of remote files if only the extensions are known.

Sample Image - IconDlg.jpg

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.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

KarstenK

Software Developer

Germany Germany

Member

I am living in germany and now living from programming for some Years. In my spare time I like sports as jogging, playing football (soccer) and basketball.
 
We must take care for our planet, because we and our family has no other. And everybody has to do something for it.

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
GeneralMy vote of 1 Pinmemberdxlee3:49 6 Oct '09  
GeneralMy vote of 2 Pinmemberaccesstomypc5:02 10 Sep '09  
GeneralIt's a pretty nice solution Pinmemberdeepkh16:33 17 Apr '08  
QuestionRemote files? PinmemberHans Dietrich5:42 23 Nov '05  
AnswerRe: Remote files? PinmemberKarstenK20:42 23 Nov '05  
GeneralRe: Remote files? PinmemberHans Dietrich21:55 23 Nov '05  
GeneralRe: Remote files? PinmemberKarstenK22:04 23 Nov '05  
QuestionSHGetFileInfo? Pinmemberhfry2:28 23 Nov '05  
AnswerRe: SHGetFileInfo? PinmemberKarstenK1:31 24 Nov '05  
Generalbroken links Pinmembertoxcct5:33 22 Nov '05  
GeneralRe: broken links PinmemberKarstenK20:31 22 Nov '05  
GeneralRe: broken links Pinmembertoxcct23:04 22 Nov '05  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Mobile
Web02 | 2.5.120517.1 | Last Updated 22 Nov 2005
Article Copyright 2005 by KarstenK
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid