Search code examples
c#iconsclone

C# Using Reshacker to change executable's Icon


There are MULTIPLE threads here asking how to change an icon - and nearly all of them say to use a command line tool such as ResHacker - but none of them (that I have seen) explain how to do so. I read into ResHacker's help file, and I found some text which explained how to go about changing the icon of a win32 executable file.

I tried the below code, and it gave me the following error: Code:

p.StartInfo.Arguments = "-addoverwrite " + txtProtect.Text + "," + txtProtect.Text + "," + sICOpath + "," + "ICONGROUP" + ", MAINICON, 0";

Error:

"C:\Users\Evan\Desktop\ResHacker.exe" -addoverwrite C:\Users\Evan\Desktop\output.exe,C:\Users\FARINA_EVAN\Desktop\output.exe,C:\Users\Evan\Desktop\ExeWithIcon.exe,ICONGROUP, MAINICON, 0

Error: Invalid resource type.


Solution

  • I wasn't able to find anything on how to programmatically run ResHacker except through manipulating the command line through C# like you are attempting to do. However, to speak to the root of your question, I found a possible solution for you here that does not require ResHacker. Instead, it allows you to modify the icon through code (C# and VB.NET). Here is the link:

    http://www.hackforums.net/archive/index.php/thread-422072-1.html