473,698 Members | 2,196 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 21 '05 #1
2 1238
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 21 '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 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
5461
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
1342
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
5656
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, simple task of embedding some icons into my assembly and use of the same at runtime, I realize I've a...
2
1928
by: Matthias Steinbart | last post by:
Hi, searched the newsgroup but couldn't find anything. Almost unbelievable. I think these must be common questions. I'd like to display the files in a given folder within a ListView. Various don't-knows: 1. How to I retrieve the associated Icon for a given file? 2. How do I retrieve the file Type (on my german OS, the explorer displays "Microsoft Word-Dokument" when selecting 'bla.doc'.) 3. How do I launch the file in it's associated...
2
8870
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 a simple way to get the icon of the file type? I've seen complex ways before, but is there any...
9
1940
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 of the one in explorer's folder options under the file types tab. Thanks!
1
1488
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 with:' label and not with the name of the program like it is with e.g.
19
3750
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 .aspx file. When you create a new aspx page in VWD, it automatically puts the code-behind file with...
1
2425
by: iwdu15 | last post by:
hi, how can i get the icon associated with a certain file type? thanks -- -iwdu15
5
6676
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 I get this?
0
8674
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8603
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8895
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
7725
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6518
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4369
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4619
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3046
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
2
2329
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.