How can I get different icon sizes from a file extension?

Is it possible to extract the associated icon from a file extension?

I found many examples, but they all need a link to a file (path). I want to be able to transfer only the extension, for example "pdf" or ".pdf", and then get the associated icon from it (small, medium, large, external and large).

Additional Information

I have some data in a database that contains information about a file. The file name and extension are the ones I need for this problem.

In my user interface, I want to show a list of all the files that are in my database. I want to show this with the file name + type file.

In my user interface, I also have a zoom device, so I can make the icons bigger or smaller, as you see in Windows Explorer (medium icons, Large icons, etc.). To do this, I would like to get a related icon that my OS uses to show the file in Windows Explorer. This icon that I can use in my list.

I found solutions where I can get the associated icon, but all of them must have a file path to retrieve the icon. For example: using SHFILEINFO to get file icons

I want to be able to pass the extension instead of the file path.

+7
c #
source share

No one has answered this question yet.

See similar questions:

25
Get icon for this extension
3
using SHFILEINFO to get file icons

or similar:

2058
How to get consistent byte representation of strings in C # without manually specifying an encoding?
1786
How to create an Excel file (.XLS and .XLSX) in C # without installing Microsoft Office?
1658
Get int value from enum in C #
1424
How to fix "No breakpoint will be deleted at this time. No characters have been loaded for this document." a warning?
890
How can I get the application path in a .NET console application?
677
How to get assembly file version
eighteen
How can I get the filetype icon that Windows Explorer shows?
one
Create a Windows extension handler for custom icons in C #
one
How to extract icon related to file extension in Windows 8?
one
Get icon from process list instead of file

All Articles