J
Jo Franklin
I am trying to save an Icon to a file. My code to extract and display the
icon works correctly, but I am unable to save it to a file. Can someone
please help with the code?
Thank you in advance.
ExtractIconEx(sFile, 1, IconPtrLarge, IconPtrSmall, 1)
myIcon = Icon.FromHandle(IconPtrLarge)
ImageListLarge.Images.Add(myIcon)
Dim iconFile As New IO.FileStream("C:\Icon1.ico", FileMode.Create)
myIcon.Save(iconFile) <-- this line is giving me the error
iconFile.Close()
myIcon.Dispose()
This is the error I'm getting
An unhandled exception of type 'System.Runtime.InteropServices.COMException'
occurred in system.drawing.dll
Additional information: Unspecified error
icon works correctly, but I am unable to save it to a file. Can someone
please help with the code?
Thank you in advance.
ExtractIconEx(sFile, 1, IconPtrLarge, IconPtrSmall, 1)
myIcon = Icon.FromHandle(IconPtrLarge)
ImageListLarge.Images.Add(myIcon)
Dim iconFile As New IO.FileStream("C:\Icon1.ico", FileMode.Create)
myIcon.Save(iconFile) <-- this line is giving me the error
iconFile.Close()
myIcon.Dispose()
This is the error I'm getting
An unhandled exception of type 'System.Runtime.InteropServices.COMException'
occurred in system.drawing.dll
Additional information: Unspecified error