How can I retrieve the system icon associated with a file/folder so that I can show it in the list view adjacent to the file/folder name?
Asked
Active
Viewed 1.2k times
2 Answers
3
You need to use Icon.ExtractAssociatedIcon
Icon icon = Icon.ExtractAssociatedIcon(filepath);
Take a look at Icon.ExtractAssociatedIcon documentation
Note: this works only for files. For folders you need P/Invoke sample is here Edit: Page is now defunct, please refer to this copy on the Wayback Machine.

Jonas Kohl
- 1,018
- 1
- 11
- 28

Sriram Sakthivel
- 72,067
- 7
- 111
- 189
-
1this only for file – PuntanetDeveloper Jun 11 '19 at 10:05
-
It doesn't work for folder, as I tested. – SleepyBag May 04 '22 at 15:50