How to make an Icon Extractor
Heres your chance to share your own tutorials with the community. Just post them on here. If your lucky they may even be posted on the main site.
Hello everyone,
Today I have decided to write a tutorial on my Icon Extractor software which I haven't posted yet. What this software will do is that it extracts the icon from the file you choose. It then saves the icon in the format of an image. I wanted it to save as .ico and I have even done a lot of search but none of the researches worked. Mandai also tried to help me out but still it doesn't came to work. So this tutorial will show you just how to save it as an image so please don't complain. And also don't post any disappointing comments.
---------------------------------------------------------------------------
First of all, open Visual Basic 2008, create a new project, choose Windows Forms Application, type in the textbox Icon Extractor and press the OK button. As soon as you have done this, the Form1 will appear on the screen on which we will design our application and code it.
First we will do the designing and then the coding. So now we will change the Form1's properties to make it look good. Change the Form1's Text property to Icon Extractor. Change it's StartPosition property to CenterScreen. Change it's FormBorderStyle to FixedSingle. Change it's MaximizeBox and MinimizeBox property to False. Change it's Size property to 159, 104.
Now add the following things to the form:
(1)_ 1 PictureBox. Change it's Size property to 48,48. Change it's SizeMode property to Zoom. Change it's BorderStyle to Fixed3D.
(2)_ 2 Buttons. Change Button1's Text property to Choose or Browse and the Button2's Text property to Save.
Now is the time to code Form1 and it's components. So right-click on the form in the Solution Explorer and click View Code.
Type the following code before Public Class Form1:
---------------------------------------------------------------------------
Voila! You have just completed making an Icon Extractor which extracts and then saves the icon as an image. Now debug and run it by pressing the Start Debugging button located at the main toolstrip. Test it, if it works fine then its SAVING time. You can save your project by going to File -> Save All and then pressing Save.
And there! You have your project and application that works. If you have any problem or can't understand something, please feel free to ask by either a comment or by PM. I have also attached a screenshot.
Please use the Give Thanks button and the Reputation System to appreciate my hard work. I have wrote this tutorial while making an Icon Extractor project myself so you can download the source file in the attachments.
Thank you.
![Image]()
Today I have decided to write a tutorial on my Icon Extractor software which I haven't posted yet. What this software will do is that it extracts the icon from the file you choose. It then saves the icon in the format of an image. I wanted it to save as .ico and I have even done a lot of search but none of the researches worked. Mandai also tried to help me out but still it doesn't came to work. So this tutorial will show you just how to save it as an image so please don't complain. And also don't post any disappointing comments.
---------------------------------------------------------------------------
First of all, open Visual Basic 2008, create a new project, choose Windows Forms Application, type in the textbox Icon Extractor and press the OK button. As soon as you have done this, the Form1 will appear on the screen on which we will design our application and code it.
First we will do the designing and then the coding. So now we will change the Form1's properties to make it look good. Change the Form1's Text property to Icon Extractor. Change it's StartPosition property to CenterScreen. Change it's FormBorderStyle to FixedSingle. Change it's MaximizeBox and MinimizeBox property to False. Change it's Size property to 159, 104.
Now add the following things to the form:
(1)_ 1 PictureBox. Change it's Size property to 48,48. Change it's SizeMode property to Zoom. Change it's BorderStyle to Fixed3D.
(2)_ 2 Buttons. Change Button1's Text property to Choose or Browse and the Button2's Text property to Save.
Now is the time to code Form1 and it's components. So right-click on the form in the Solution Explorer and click View Code.
Type the following code before Public Class Form1:
Code: Select all
Write the following code by double-clicking Button1 whose Text property was Choose:
Imports System.Drawing
Imports System.Drawing.Imaging
Code: Select all
And this is the final code. Double-click Button2 and add the following code:
Dim openDLG As New OpenFileDialog
openDLG.Title = "Select the file whose icon you want to extract."
openDLG.Filter = "All Icon Sources (*.*)|*.*"
If openDLG.ShowDialog = Windows.Forms.DialogResult.OK Then
PictureBox1.Image = Drawing.Icon.ExtractAssociatedIcon(openDLG.FileName).ToBitmap
End If
Code: Select all
Well, that's all. It was real easy, wasn't it?Dim saveDLG As New SaveFileDialog
saveDLG.Title = "Select the filename where you want to save the extracted icon."
saveDLG.Filter = "Image File Types (*.bmp,*.gif,*.ico,*.jpg,*.jpeg,*.png,*.tiff)|*.bmp;*.gif;*.ico;*.jpg;*.jpeg;*.png;*.tiff"
If saveDLG.ShowDialog = Windows.Forms.DialogResult.OK Then
PictureBox1.Image.Save(saveDLG.FileName)
End If
---------------------------------------------------------------------------
Voila! You have just completed making an Icon Extractor which extracts and then saves the icon as an image. Now debug and run it by pressing the Start Debugging button located at the main toolstrip. Test it, if it works fine then its SAVING time. You can save your project by going to File -> Save All and then pressing Save.
And there! You have your project and application that works. If you have any problem or can't understand something, please feel free to ask by either a comment or by PM. I have also attached a screenshot.
Please use the Give Thanks button and the Reputation System to appreciate my hard work. I have wrote this tutorial while making an Icon Extractor project myself so you can download the source file in the attachments.
Thank you.

You do not have the required permissions to view the files attached to this post.
well , you can't choose your size :?
YourSocksRoxx wrote:well , you can't choose your size :?When did I said that you can?
Usman55 wrote:i didn't say you said that , but it would e useful if you couldYourSocksRoxx wrote:well , you can't choose your size :?When did I said that you can?
YourSocksRoxx wrote:I am going to add it in my next upload. I had that feature in my application since last week but I don't know the code of how to save the image with the size of the picturebox. I was using the Zoom SizeMode but it didn't worked. Any help?Usman55 wrote:i didn't say you said that , but it would e useful if you couldYourSocksRoxx wrote:well , you can't choose your size :?When did I said that you can?
This is great, works well. But it would be even better if you add the options of getting the icon from open processes. Like if Google Chrome is open. U just habe to time "chrome' into a box and the icon is there!
Do this by using Process.Mainmodule.Filename.Tostring to find the location of a running process. Good luck!.
Do this by using Process.Mainmodule.Filename.Tostring to find the location of a running process. Good luck!.
I made a program to do that a while back: viewtopic.php?f=38&t=3625&p=25235#p25235
This has already been posted, in the exact same layout, but if you never viewed that tutorial then good job!
when you say extract an icon, do you mean from exe, dll, or .ico?
Copyright Information
Copyright © Codenstuff.com 2020 - 2023