473,582 Members | 3,046 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 8866
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.co m

"Brian Henry" <no****@nospam. com> wrote in message
news:ue******** ******@TK2MSFTN GP15.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=getfiledesc ription&lang=en >

Getting File Icons Using The Shell
<URL:http://vbaccelerator.c om/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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
5446
by: Dave Smithz | last post by:
Hi There, I have a PHP script that sends an email with attachment and works great when provided the path to the file to send. However this file needs to be on the same server as the script. I want to develop a webpage where people can send attachments that are stored on their local PC.
2
1337
by: DraguVaso | last post by:
Hi, In my application I need to list some files (a little bit like in windows explorer), and I wan't to show next to each file the right Icon, as used in windows explorer. how can i find which Icon is used for each file-type, and use that icon to be shown in my application? Thanks a lot in advance, Pieter
3
5648
by: Kendall Gifford | last post by:
Greetings. While trying to get a simple app working, I've been forced to delve into embedded and/or linked resources a bit. I read all the reference for the System.Resources namespace as well as all the material within the "Resources and Localization..." tutorial. While I'm confident I now know completely how to accomplish my original,...
9
1930
by: Brian Henry | last post by:
How do you go about getting the "type" of a file from explorer? Say if I want to know what the type for the extension .DOC was, which is "Micrsoft Word Document" in explorer, how would I do this? I just want to get the name of the extension.. I do not have the physical file to reference for this, I just want to make a listing similar to that...
1
1486
by: Jesper | last post by:
Hi, I've done some file type assignment to a program I've made such that e.g. when I double click on files of type .foo it will be openened in my program. However, I'm still missing two things: 1) When I right click on the .foo file (in MS Windows) and selects properties, my application is only shown with its icon under the 'opens...
19
3735
by: Alan Silver | last post by:
Hello, I have been developing ASP.NET with a text editor so far (better way to learn initially), and have now been trying Visual Web Developer. I want to create a project for an existing site and add the files to it. I can add my .aspx and .cs (code-behind) files, but VWD doesn't know which .cs file si the code-behind for any particular...
2
1234
by: Brian Henry | last post by:
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...
1
2412
by: iwdu15 | last post by:
hi, how can i get the icon associated with a certain file type? thanks -- -iwdu15
5
6672
by: =?Utf-8?B?TG9hbldvbGY=?= | last post by:
I'm working on a Windows Explorer-like application. What is the best way to find out what application is set to open a particular type of file? Is there a function to do this? Do I have to go through the registry and check ClassesRoot? Also, once I have the application, I want to be able to get the icon for that application. How would...
0
7886
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7809
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8159
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8312
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7920
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8183
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5685
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
1
2312
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1147
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.