views:

86

answers:

3

How can I change *.EXEs icons from c# code (not my main app icon but from that app i want to change the icon of another exe).

I eventually would have to change the icons for A LOT of files so I am looking for a fast and good performance way to do it.

I have been googling for 30min but all I found is how to set the icon for the app in VS.

+2  A: 

You need to call the Resources API methods, as described here.

Specifically, you need to call BeginUpdateResource, UpdateResource, and EndUpdateResource.

SLaks
A: 

See this. http://www.angusj.com/resourcehacker/

It is definitely not through C# but its eventually fast and good performance way as you asked.

EDIT
All About Resource Hacker in a Brief Tutorial

Ismail
He wants to do it programatically.
SLaks
Yep, I need to do it from inside my app, I already use res hacker sometimes, maybe if rh was a console app I could integrate in my code but I bet that would be kinda slow.
flyout
A: 

Rather than hacking the resource in the .exe (not very friendly), you could instead create a shortcut to the exe, which will allow you to easily use your own icon in the shortcut. See here for more info on how to do this, using the ShellLink class.

ShellShock
Thats not what I need, if I have to move the exes+shortcuts that would be a mess.
flyout