I have a WPF application that needs to extract the icon off of an executable.
I found here that I can do this
Icon ico = Icon.ExtractAssociatedIcon(theProcess.MainModule.FileName);
but when I try to set the source of a WPF Image I get
“Cannot implicitly convert type ‘System.Drawing.Icon’ to ‘System.Windows.Media.ImageSource’
Any suggestions ?
Icons get no love in the .NET framework. You’ll have to use Icon.Save() to save the icon you got into a MemoryStream. Which allows you to use the IconBitmapDecoder constructor that takes a stream.