469,631 Members | 1,218 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,631 developers. It's quick & easy.

Getting file type name and/or icon from explorer

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!
Nov 17 '05 #1
2 8685
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/...tFileInfo.html

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Brian Henry" <no****@nospam.com> wrote in message
news:ue**************@TK2MSFTNGP15.phx.gbl...
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!

Nov 17 '05 #2
Brian,

"Brian Henry" <no****@nospam.com> schrieb:
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>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by DraguVaso | last post: by
9 posts views Thread by Brian Henry | last post: by
1 post views Thread by Jesper | last post: by
19 posts views Thread by Alan Silver | last post: by
1 post views Thread by iwdu15 | last post: by
5 posts views Thread by =?Utf-8?B?TG9hbldvbGY=?= | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.