Extract icon from file

Extract icons from any exe and dll files. There is 2 way to extract an icon from a file in Windows : the easy way and the hard way.
Today, I’ll show you the easy way using the ExtractAssociatedIcon from the System.Drawing.Icon Namspace.

Let’s say you have a form in Visual Basic Express 2010 or Visual Studio 2010 and you would like to change the default icon for another one.


[Default icon]

You have to choose the icon from the file. Identify the path and the full file name. In my example, I choose the logo from Windows about :


C:\Windows\System32\winver.exe







Here is what your code would look like:




    Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load

        'C:\Windows\System32\winver.exe
        If System.IO.File.Exists("C:\Windows\System32\winver.exe") Then
            Me.Icon = System.Drawing.Icon.ExtractAssociatedIcon("C:\Windows\System32\winver.exe")
        End If

    End Sub






The final result if you run your code, the logo from your file is reused in your project or your form.











About 

I invite you to visit my blog for more articles and leave a comment. Check Technologies represents more than 10 years .... Computer and computer aided design.


235 Adrien-Provencher
Beloeil, (Québec), J3G 0C8, Canada
Tel : 514-705-7690
emal: info@checktechno.ca




0 Response to "Extract icon from file"

Posting Komentar