Click here to Skip to main content
11,639,548 members (68,465 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: C#
This issue is related to my previous question.
I'm browsing to the .exe with the openFileDialog and create a shortcut into a designated folder inside the aplication.

What I'm now trying is to save the icon of that aplication into a folder as a jpeg or any other format.

I'm doing this because I'm storing the path of the icon into my database, and also saving the sample icon into a folder I created inside the aplication.

Thanks in advance once again!
Posted 29-Jan-13 5:49am
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Icon result = Icon.ExtractAssociatedIcon(filePath)

The below code is not my own but will work once you have the icon saved as a variable.
string s = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + @"\IconData.ico";
using (FileStream fs = new FileStream(s, FileMode.Create))
Steven Borges at 29-Jan-13 12:10pm
And how do I send the extracted file to the path I desire?
Gerenatian at 29-Jan-13 12:50pm
I updated my solution to add the ability to extract the icon to a directory.
Steven Borges at 29-Jan-13 16:29pm
Thanks, does the .ico still work to use as a background in the property of an tool I place?
Steven Borges at 1-Feb-13 5:01am
Seems like I can't use the .ico
Isn't there a way to convert the .ico to a .jpg so that I can use it as a background in the code?
Steven Borges at 1-Feb-13 6:03am
Forget it mate, your code is perfect, all I had to do is instead of using @"\IconData.ico"; using @"\IconData.jpg" instead;

Thank you very much.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

kindly check the link for batter information[^]

click here to download icon extractor[^]
Marcus Kramer at 30-Jan-13 9:20am
My 1. He doesn't want a piece of software to do this, he is looking for a way to do this from within his application.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Suvendu Shekhar Giri 330
1 Sergey Alexandrovich Kryukov 299
2 CPallini 187
3 himanshu agarwal 167
4 F-ES Sitecore 160
0 OriginalGriff 9,081
1 Sergey Alexandrovich Kryukov 8,812
2 Mika Wendelius 7,027
3 Suvendu Shekhar Giri 2,650
4 F-ES Sitecore 2,548

Advertise | Privacy | Mobile
Web01 | 2.8.150731.1 | Last Updated 29 Jan 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100