473,385 Members | 1,676 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

How to get the Symbol/Icon associated with special directory or file

Hi,
I asked u this morning:

---------------------------------------
I want to programm some kind of Explorer like the Windows Explorer.
And I want to know how can i get the same Icons/Symbols for the files and
directories like the Windows Explorer uses.

Example:

The Icon for the Desktop.

With the Command:
Environment.GetFolderPath(Environment.SpecialFolde r.Desktop)
I can get the folder where the Windows Desktop is located.

But how can I get the standart icon for the desktop?
--------------------------------------

U answerd me:

---------------------------------------
You'll have to use WinApi's SHGetFileInfo method. Check these:

http://support.microsoft.com/?kbid=319350

http://www.codeguru.com/Csharp/Cshar...cle.php/c4261/

Note that for retrieving icons for individual files, it is much faster to
use filename extension since it will fetch icons from the shell icon cache.
--------------------------------------

This works fine, but, I don't get the right Icon for the Desktop. If I use
the directory where the desktop is stored in, I get a simple Folder Icon.
Not the nice blue Desktop Icon.

Does s.o. know how to get that Icon? (And all the other special Icons)
Thanx

Alex
Nov 16 '05 #1
7 7279
>
http://www.codeguru.com/Csharp/Cshar...cle.php/c4261/

Note that for retrieving icons for individual files, it is much faster to
use filename extension since it will fetch icons from the shell icon
cache.
--------------------------------------

This works fine, but, I don't get the right Icon for the Desktop. If I use
the directory where the desktop is stored in, I get a simple Folder Icon.
Not the nice blue Desktop Icon.

Does s.o. know how to get that Icon? (And all the other special Icons)


Have you tried just getting the Icon for "Desktop"?

I don't know if it'll work, but its worth a shot.
Nov 16 '05 #2

"Daniel O'Connell [C# MVP]" <onyxkirx@--NOSPAM--comcast.net> schrieb im
Newsbeitrag news:u4**************@TK2MSFTNGP14.phx.gbl...

http://www.codeguru.com/Csharp/Cshar...cle.php/c4261/

Note that for retrieving icons for individual files, it is much faster to
use filename extension since it will fetch icons from the shell icon
cache.
--------------------------------------

This works fine, but, I don't get the right Icon for the Desktop. If I
use the directory where the desktop is stored in, I get a simple Folder
Icon. Not the nice blue Desktop Icon.

Does s.o. know how to get that Icon? (And all the other special Icons)


Have you tried just getting the Icon for "Desktop"?

I don't know if it'll work, but its worth a shot.


Yes I tried, but it doesn't work. Any other ideas?
Nov 16 '05 #3
Not sure but have a look here: www.thedrebin.com

It shows one way to extract ico stuff from shell32.dll.
Nov 16 '05 #4
Well..

in this class the following statement is used:

System.Drawing.Icon.ExtractAssociatedIcon(....)

The ExtractAssociatedIcon method does not exist in the System.Drawing.Icon
class.

Does s.o. know how to fix?

"Joep" <St***@DeStoep.nl> schrieb im Newsbeitrag
news:41***********************@news.xs4all.nl...
Not sure but have a look here: www.thedrebin.com

It shows one way to extract ico stuff from shell32.dll.

Nov 16 '05 #5
What about?

http://www.winfx247.com/247reference...AssociatedIcon

Any good? Guess not, so then maybe use the win32 equivalent? That will work
for sure but requires a wrap, shell32.dll, ExtractAssociatedIcon.



Nov 16 '05 #6
Uhhh wow.... they say:
First seen in: .NET v1.2.30703

The newest .Net version is 1.1, isn't it?

Maybee, i look for that version.... :-)

"Joep" <St***@DeStoep.nl> schrieb im Newsbeitrag
news:41***********************@news.xs4all.nl...
What about?

http://www.winfx247.com/247reference...AssociatedIcon

Any good? Guess not, so then maybe use the win32 equivalent? That will
work for sure but requires a wrap, shell32.dll, ExtractAssociatedIcon.


Nov 16 '05 #7
Ohh... wow.. the newest .net Framework is 2.0 on microsoft.com :-)

I think this will solve many problems.

So far, many thanks for your help.
"Alexander Keßler" <al**************@gmx.net> schrieb im Newsbeitrag
news:ck**********@news.uni-kl.de...
Uhhh wow.... they say:
First seen in: .NET v1.2.30703

The newest .Net version is 1.1, isn't it?

Maybee, i look for that version.... :-)

"Joep" <St***@DeStoep.nl> schrieb im Newsbeitrag
news:41***********************@news.xs4all.nl...
What about?

http://www.winfx247.com/247reference...AssociatedIcon

Any good? Guess not, so then maybe use the win32 equivalent? That will
work for sure but requires a wrap, shell32.dll, ExtractAssociatedIcon.



Nov 16 '05 #8

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

Similar topics

11
by: Danny Pressley | last post by:
I have a VS.NET 2003 Visual C++ MFC Application Project in which I added a new resource file, I then added an icon to this new resource file and did a rebuild and got the following error: "fatal...
8
by: Ed Isenberg | last post by:
I notice that a lot of Web pages have an icon that is displayed preceding the URL in the place in the browser where the URL is displayed. When I bookmark or add this to Favorites the icon is also...
2
by: Alexander Keßler | last post by:
Hi, I want to programm some kind of Explorer like the Windows Explorer. And I want to know how can i get the same Icons/Symbols for the files and directories like the Windows Explorer uses. ...
8
by: Dinesh Jain | last post by:
Hi al,, I have written a code which displays directory listing of files from FTP server directory.I display all the files in a listview with its associated icons. To display icons, I get the...
5
by: IcingDeath via DotNetMonster.com | last post by:
I am building this SQL Server database app in which i can store files. In order to display files I want to have the app show the associated icon for the extension of the file that is in the...
1
by: Brian Kitt | last post by:
Over the years, from time to time, I've added a website as a 'favorite', and noticed that an icon (other than the standard ie icon) would be associated with it. Unfortunatley I don't have any of...
4
by: techspirit | last post by:
Hi all, 1) I found out from the vb.net group that it is possible to get an associated icon for a file. My requirement is to display all programs from the Start Menu for the user along with the...
3
by: Olav | last post by:
Hi all, I can not install CF 2.0 SP 1 on an Symbol PPT8800 running WinCE 4.2. The Install-Log say's cgacutil.exe failed with exit-code 80000004 and I get a messagebox indicating a support-Info...
2
by: f rom | last post by:
----- Forwarded Message ---- From: Josiah Carlson <jcarlson@uci.edu> To: f rom <etaoinbe@yahoo.com>; wxpython-users@lists.wxwidgets.org Sent: Monday, December 4, 2006 10:03:28 PM Subject: Re: ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...

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.