Hack Forums
[C#] C# Get the target application icon then set it to Application.ExecutablePath - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [C#] C# Get the target application icon then set it to Application.ExecutablePath (/showthread.php?tid=4945888)



C# Get the target application icon then set it to Application.ExecutablePath - DaHaxor - Aug 11, 2015

How can i get the target application ICON then delete the target application then copy the Application.ExecutablePath into the target directory then set the icon.

However if you dont under stand:
Code
public static void Main()
{
      string path = @"C:\Users\Haxor\Desktop\App.exe\";
      Icon.Get (path); ???????
      File.Delete (path);
      File.Copy(path, Name:StillTheSame App.exe;
      Icon.Set (path, SavedIconFromSecondLine);
}

Can you make that possible for me? 🤝


* - tweety - Aug 11, 2015

Icon.ExtractAssociatedIcon()
https://msdn.microsoft.com/en-us/library/system.drawing.icon.extractassociatedicon(v=vs.110).aspx


* - DaHaxor - Aug 11, 2015

(Aug 11, 2015 11:14 PM)Tweety. Wrote:  Icon.ExtractAssociatedIcon()

Thank you! Sir 🤗

Solved


* - salmoneus - Aug 12, 2015

(Aug 11, 2015 11:14 PM)Tweety. Wrote:  Icon.ExtractAssociatedIcon()
https://msdn.microsoft.com/en-us/library/system.drawing.icon.extractassociatedicon(v=vs.110).aspx

Just FYI, this extracts the associated icon, i.e the icon associated with the file extension (or format?). Regardless, if you want to find the icon stored in the resources, which is probably what you're looking for, check out this library: https://github.com/dblock/resourcelib