Getting file type name and/or icon from explorer

  • Thread starter Thread starter Brian Henry
  • Start date Start date
B

Brian Henry

I want to list out a directory listing along with showing the file type name
(like explorer does when it says something like "MyDoc.DOC - Microsoft Word
Document" How do I get that file type name which is Microsoft Word Document
based on the extension or what ever it needs to figure out the type so i can
display it in a program? also is there a simple way to get the icon of the
file type? I've seen complex ways before, but is there any simple ways to?
thanks!
 
Brian,

There is no simple way to get it as far as I know. What you need to do
is call the SHGetFileInfo API function through the P/Invoke layer.
Fortunately, the details of the declaration have already been handled for
you on pinvoke.net. You can find the definition you need (and supporting
structures) at (watch for line wrap):

http://www.pinvoke.net/default.aspx/shell32/SHGetFileInfo.html

Hope this helps.
 
Brian,

Brian Henry said:
I want to list out a directory listing along with showing the file type
name (like explorer does when it says something like "MyDoc.DOC - Microsoft
Word Document" How do I get that file type name which is Microsoft Word
Document based on the extension or what ever it needs to figure out the
type so i can display it in a program? also is there a simple way to get
the icon of the file type? I've seen complex ways before, but is there any
simple ways to?

The .NET Framework does not provide managed support to determine file type
descriptions and icons.

Determining the description of a file's file type
<URL:http://dotnet.mvps.org/dotnet/faqs/?id=getfiledescription&lang=en>

Getting File Icons Using The Shell
<URL:http://vbaccelerator.com/article.asp?id=4302>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

How to fix Steam game icons appearing as .url files 1
Create a icon. 3
Open files in associated editors. 1
Get Icon And Display 2
Can't delete file 3
Windows Vista Lost AOL icon 3
Get file's associated application / app icon 5
Windows 10 New Win 10 File Explorer 2

Back
Top