VISUAL_BASICSIcon File Extractor

Posts 1–4 of 4 · Page 1 of 1
Icon File Extractor
Hello guy in this tutorial you gonna learn how to make an icon extractor which extract icons from files and save them , first you must include this on your source code
Code:
 Dim extractpath As String
    Dim savepath As String
  • 1 Tools we need:
    - 3 Buttons
    - 2 Textboxs
    - 1 PictureBox



  • 2 Changing tool text:
    - Button1 = Browse File
    - Button2 = Save Extracted icon
    - Button3 = Extract



  • 3 Coding:
    Browse Executable Button
    Code:
       Dim s As New OpenFileDialog
            If s.ShowDialog = Windows.Forms.DialogResult.OK Then
                PictureBox1.Image = Icon.ExtractAssociatedIcon(s.FileName).ToBitmap()
                extractpath = s.FileName
                TextBox1.Text = s.FileName
            End If


    Save Extracted icon
    Code:
      Dim s As New SaveFileDialog
            If s.ShowDialog = Windows.Forms.DialogResult.OK Then
                savepath = s.FileName
                TextBox2.Text = s.FileName
            End If


    Extract
    Code:
       If savepath = Nothing Then
                MsgBox("Select a path to save the icon first", MsgBoxStyle.Critical, "Select path!")
                Exit Sub
            End If
            If extractpath = Nothing Then
                MsgBox("Select a path to extract the icon from", MsgBoxStyle.Critical, "Select path!")
                Exit Sub
            End If
    
            Try
                Dim bm As New Bitmap(PictureBox1.Image)
                Dim ico As Icon = Icon.FromHandle(bm.GetHicon)
                Dim fs As New System****.FileStream(savepath & ".ico", IO.FileMode.CreateNew)
                ico.Save(fs)
                fs.Close()
            Catch ex As Exception
                MsgBox("A following error occured: " & vbCrLf & vbCrLf & ex.ToString)
            End Try
        End Sub


I have here an Error.
31K93.png3 KB · 8 downloads
Thanks for this
Posts 1–4 of 4 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Need help?