tags:

views:

48

answers:

1

I am looking for a C/C++ code which can get icon for a given filetype (eg. .doc, .pdf) on Windows. I need to make an application which will display a list of files and I need to have the file icons corresponding to those files.

I have seen C# code for the same but I have never worked with C# and don't think that I can use the same code for my use.

Please help!

+1  A: 

I've found this: http://msdn.microsoft.com/en-us/magazine/cc301425.aspx

So you basically call SHGetFileInfo with SHGFI_USEFILEATTRIBUTES and any file name/path (it doesn't matter if it doesn't exist), and it writes the filetype info to a SHFILEINFO.

tiftik
Thanks tiftik.It appears to be a very old link (Nov 2000). Do you think this method will still work?Also, I couldn't download the code for the small application that was made by the author, do you have the source code to try out this approach.I am very new to C++ programming and don't know how to proceed with this information and make an application like the one made by the author. Could you please help.
Ashish
Windows has a well-deserved reputation for interface stability. These interfaces still work in Windows 7, and there's no announcement of their withdrawal. So you can expect them to work well past 2020.
MSalters
It has to work, MSDN doesn't say anything about the function being deprecated. You need to include windows.h and Shellapi.h in your code and tell the compiler/linker to use Shell32.lib.
tiftik