473,414 Members | 1,980 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,414 software developers and data experts.

FolderOptions > FileTypes > Icons

I'm trying to get a list of all file icons registered to file extensions
located on the machine. I would like to beable to loop through all icons
and save the images in a seperate directory named after the extension they
are mapped to. Should be no problem but I can't seem to find any
information on finding a way to get a list of icons and extensions
registered on the system.
Thanks,
Ron
Nov 16 '05 #1
3 2129
Hi Ron,

Based on my understanding, you want to get all the registed file extensions
in Windows system, then you want to get the associated icons of these file
extension.

================================
Actually, all the registed file extensions are stored in registry. They are
stored as the sub keys of HKEY_CLASSES_ROOT key.

In C#, you may use Microsoft.Win32.RegistryKey to access the registry, then
loop through all the HKEY_CLASSES_ROOT's sub keys, that is started with
"."(such as .bmp, .avi etc)

I also want to inform you that, the icon is not associated with certain
file extension. Each file extension has default open program(For details,
it also associates with certain behavior). And the icon is associated with
the open program and behavior. So you should first find the default open
behavior of the file extension, then find the associated icon.

Take .mp3 file for example:
1). Use RegistryKey.GetValue to get the (Default) program behavior
associated with ".mp3" file extension.(On my machine, it is "Winamp.File")
2). Find "Winamp.File" sub key also in HKEY_CLASSES_ROOT key.
3). There should be a "DefaultIcon" sub key in "Winamp.File".
4). Then, also use RegistryKey.GetValue method to retrieve the associated
icon address(On my machine, it is "C:\Program Files\Winamp\Winamp.exe,1")

At last, you should P/invoke ExtractAssociatedIcon Win32 API to retrieve
the associated icon.

================================
Please apply my suggestion above and let me know if it helps resolve your
problem.

Thank you for your patience and cooperation. If you have any questions or
concerns, please feel free to post it in the group. I am standing by to be
of assistance.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 16 '05 #2
Excellent! haven't tried it but sounds like it will work

Ron

""Jeffrey Tan[MSFT]"" <v-*****@online.microsoft.com> wrote in message
news:Fk*************@cpmsftngxa06.phx.gbl...
Hi Ron,

Based on my understanding, you want to get all the registed file extensions in Windows system, then you want to get the associated icons of these file
extension.

================================
Actually, all the registed file extensions are stored in registry. They are stored as the sub keys of HKEY_CLASSES_ROOT key.

In C#, you may use Microsoft.Win32.RegistryKey to access the registry, then loop through all the HKEY_CLASSES_ROOT's sub keys, that is started with
"."(such as .bmp, .avi etc)

I also want to inform you that, the icon is not associated with certain
file extension. Each file extension has default open program(For details,
it also associates with certain behavior). And the icon is associated with
the open program and behavior. So you should first find the default open
behavior of the file extension, then find the associated icon.

Take .mp3 file for example:
1). Use RegistryKey.GetValue to get the (Default) program behavior
associated with ".mp3" file extension.(On my machine, it is "Winamp.File")
2). Find "Winamp.File" sub key also in HKEY_CLASSES_ROOT key.
3). There should be a "DefaultIcon" sub key in "Winamp.File".
4). Then, also use RegistryKey.GetValue method to retrieve the associated
icon address(On my machine, it is "C:\Program Files\Winamp\Winamp.exe,1")

At last, you should P/invoke ExtractAssociatedIcon Win32 API to retrieve
the associated icon.

================================
Please apply my suggestion above and let me know if it helps resolve your
problem.

Thank you for your patience and cooperation. If you have any questions or
concerns, please feel free to post it in the group. I am standing by to be
of assistance.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 16 '05 #3
Hi Ron,

Thanks for your feedback. I am glad my reply makes sense to you.

If you meet some further problem, please feel free to post, I will help
you. Thanks

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 16 '05 #4

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

Similar topics

1
by: Jakob Bengtsson | last post by:
Hi, Does anyone know how to get the icons for all filetypes installed on the system? I can extract the associated icon from a file, but I don't know how to: 1) Get a list of filetypes; 2) Get...
3
by: Ron Vecchi | last post by:
I'm trying to get a list of all file icons registered to file extensions located on the machine. I would like to beable to loop through all icons and save the images in a seperate directory named...
4
by: Ron Vecchi | last post by:
I'm trying to get a list of all file icons registered to file extensions located on the machine. I would like to beable to loop through all icons and save the images in a seperate directory named...
1
by: Jakob Bengtsson | last post by:
Hi, Does anyone know how to get the icons for all filetypes installed on the system? I can extract the associated icon from a file, but I don't know how to: 1) Get a list of filetypes; 2) Get...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...
0
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,...
0
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...
0
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,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.