13-07-18, 02:47 AM
كود :
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim op As OpenFileDialog
op = New OpenFileDialog
' op.Filter = "EXE|*.exe"
If op.ShowDialog = Windows.Forms.DialogResult.OK Then
ExtractAssociatedIconEx(op.FileName)
End If
End Sub
Private Sub ExtractAssociatedIconEx(ad As String)
Dim ico As Icon = Icon.ExtractAssociatedIcon(ad)
Dim sv As New SaveFileDialog
sv.Filter = "ico|*.ico"
If sv.ShowDialog = Windows.Forms.DialogResult.OK Then
Using ms As New IO.MemoryStream
ico.Save(ms)
Dim b() As Byte = ms.ToArray
Using bw As New IO.BinaryWriter(New IO.FileStream(sv.FileName, IO.FileMode.Create))
bw.Write(b)
End Using
End Using
End If
End Sub