PC Review


Reply
Thread Tools Rate Thread

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

 
 
Alexander Ke▀ler
Guest
Posts: n/a
 
      15th Oct 2004
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.SpecialFolder.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


 
Reply With Quote
 
 
 
 
Daniel O'Connell [C# MVP]
Guest
Posts: n/a
 
      16th Oct 2004
>
> 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.


 
Reply With Quote
 
 
 
 
Alexander Ke▀ler
Guest
Posts: n/a
 
      16th Oct 2004

"Daniel O'Connell [C# MVP]" <(E-Mail Removed)> schrieb im
Newsbeitrag news:(E-Mail Removed)...
> >
>> 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?


 
Reply With Quote
 
Joep
Guest
Posts: n/a
 
      16th Oct 2004
Not sure but have a look here: www.thedrebin.com

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


 
Reply With Quote
 
Alexander Ke▀ler
Guest
Posts: n/a
 
      16th Oct 2004
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" <(E-Mail Removed)> schrieb im Newsbeitrag
news:4170ecfe$0$14941$(E-Mail Removed)4all.nl...
> Not sure but have a look here: www.thedrebin.com
>
> It shows one way to extract ico stuff from shell32.dll.
>
>



 
Reply With Quote
 
Joep
Guest
Posts: n/a
 
      16th Oct 2004
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.







 
Reply With Quote
 
Alexander Ke▀ler
Guest
Posts: n/a
 
      16th Oct 2004
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" <(E-Mail Removed)> schrieb im Newsbeitrag
news:41713ef4$0$78753$(E-Mail Removed)4all.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.
>
>
>
>
>
>
>



 
Reply With Quote
 
Alexander Ke▀ler
Guest
Posts: n/a
 
      16th Oct 2004
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" <(E-Mail Removed)> schrieb im Newsbeitrag
news:cks0oa$scj$(E-Mail Removed)-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" <(E-Mail Removed)> schrieb im Newsbeitrag
> news:41713ef4$0$78753$(E-Mail Removed)4all.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.
>>
>>
>>
>>
>>
>>
>>

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
System.IO.Directory.GetDirectories() and System.IO.Directory.GetFiles() are not returning the specified directory Nathan Sokalski Microsoft ASP .NET 2 6th Sep 2007 04:58 PM
Get associated Icon based on file type not actual file IcingDeath via DotNetMonster.com Microsoft VB .NET 5 21st Sep 2005 07:02 PM
Active directory: Get users associated with groups Mark Microsoft Dot NET 3 15th Mar 2005 08:25 AM
How to get the Symbol/Icon associated with a file or directory name Alexander Ke▀ler Microsoft C# .NET 2 15th Oct 2004 11:06 AM
Get file name of associated aspx file Sacha Korell Microsoft ASP .NET 4 7th Jan 2004 10:55 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:27 AM.