Click here to Skip to main content
12,953,937 members (51,287 online)
Click here to Skip to main content
Add your own
alternative version


14 bookmarked
Posted 21 Nov 2005

Getting Icons of Remote Files

, 21 Nov 2005 CPOL
Rate this:
Please Sign up or sign in to vote.
An easy way to get the icons of remote files if only the extensions are known.

Sample Image - IconDlg.jpg


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.


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.


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


About the Author

Software Developer
Germany Germany
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.

You may also be interested in...

Comments and Discussions

GeneralMy vote of 1 Pin
dxlee6-Oct-09 3:49
memberdxlee6-Oct-09 3:49 
GeneralMy vote of 2 Pin
accesstomypc10-Sep-09 5:02
memberaccesstomypc10-Sep-09 5:02 
GeneralIt's a pretty nice solution Pin
deepkh17-Apr-08 16:33
memberdeepkh17-Apr-08 16:33 
QuestionRemote files? Pin
Hans Dietrich23-Nov-05 5:42
memberHans Dietrich23-Nov-05 5:42 
AnswerRe: Remote files? Pin
KarstenK23-Nov-05 20:42
memberKarstenK23-Nov-05 20:42 
GeneralRe: Remote files? Pin
Hans Dietrich23-Nov-05 21:55
memberHans Dietrich23-Nov-05 21:55 
GeneralRe: Remote files? Pin
KarstenK23-Nov-05 22:04
memberKarstenK23-Nov-05 22:04 
QuestionSHGetFileInfo? Pin
hfry23-Nov-05 2:28
memberhfry23-Nov-05 2:28 
AnswerRe: SHGetFileInfo? Pin
KarstenK24-Nov-05 1:31
memberKarstenK24-Nov-05 1:31 
Generalbroken links Pin
toxcct22-Nov-05 5:33
membertoxcct22-Nov-05 5:33 
GeneralRe: broken links Pin
KarstenK22-Nov-05 20:31
memberKarstenK22-Nov-05 20:31 
GeneralRe: broken links Pin
toxcct22-Nov-05 23:04
membertoxcct22-Nov-05 23:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    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 | Terms of Use | Mobile
Web02 | 2.8.170525.1 | Last Updated 22 Nov 2005
Article Copyright 2005 by KarstenK
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid