• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2329
  • Last Modified:

How to change an embedded icon of a .exe file?

Hi, dudes, i've got a exe file in windows, but now i want to change the embedded icon of it. is there anyone know how to achieve it? is that possible to do it using MS VisualC++? or other utilities......

Thanks in advance!

1 Solution
i've tried to write this once before and although every function was returning a success indication it didn't actually work. i haven't been able to look at it since but you are supposed to be able to do this using. UpdateResource, you first have to find the icon which should be of type RT_ICON, and the resource id should be 1
i'm not 100% if you also need to change an RT_GROUP_ICON along with it, i read somewhere that you did. you use FindResource to find the icon in the exe , which shouldn't be running, then use BeginUpdateResource, UpdateResource, and EndUpdateResource.
for some reason when i did this a tmp file was created in the directory of the exe and the icon didn't change. like i said everything returned succesfully and ive used these functions before. i've written and updated exe's that contained other exes (raw binary resources) sort of like exe binding. if anyone knows more please post.
also, you can use an HICON it has to be the type of raw ico data that would be in the exe
If you are using VC++/VS just go to file|open (select the all files mask) locate your exe and open it. VS should no what to do with it. All the resources in that app will be displayed according to their type in a tree view. Next find your icon edit it in VS or copy it to the clipboard and paste it back in (make sure you keep/select the transparent color) then save it out file|save. The exe should be saved with the new icon.
maybe i read the question wrong, do you want to just change the exe once on your computer for your use or do you want to know how to programatically do it through c++ code to any other exe file???
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

You may consider this product.

If I understand correctly you want to basically set an icon (eg. your own 32x32 bitmap) for your program? In VC++ in the Winmain function when you declare your WNDCLASS values you should change this value:

wndclass.hIcon         = LoadIcon (hInstance, MAKEINTRESOURCE(IDI_MYICON));

Where IDI_MYICON is your included resource 32x32 ico file.
boyericAuthor Commented:
Hi, chsoh, although you've given the laziest answer, anyway i have to admit that's the most practical of all. Thanks much!
If i need to  change program icon.  I would use microangelo from www.impactsoftware.com  and just use librarian part and go change icon :)


use reshack from http://anton.concord.ru/ftp/reshack/ to change icon  :)    

few ways to do the icon changing.


Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now