473,734 Members | 2,798 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 8871
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
5466
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
1347
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
5658
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...
9
1946
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
1490
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
3756
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...
2
1240
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...
1
2431
by: iwdu15 | last post by:
hi, how can i get the icon associated with a certain file type? thanks -- -iwdu15
5
6677
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
8946
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
8776
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,...
0
9449
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9236
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
9182
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8186
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...
0
4809
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2724
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2180
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.