It occurs when there is not enough buffer in the target executable. For this you can refer to Updating version information at run-time at codeproject
Hi shabbir, thanks for responding. I have seen the reference you pointed me to, but it's not quite the same scenario. The example at codeguru is updating the version number (at runtime) in a Version resource that is already compiled into the executable. In my case, I am trying to copy a version resource from one executable into another executable that doesn't have any resources compiled into it at all. I am wondering if you know of a way to do that or if it is possible. What I am trying to do works if the destination executable has a resource (any resource ie. icon, dialog etc.) compiled into it already, but it doesn't work if the destination executable doesn't have a resource compiled into it already. Thanks, John
JohnnyH, can you share your code so that we can have a look at it. I would suggest using a new thread in the Queries and Discussion forum.
hy! hope you'll be fine, thanks for the code but could you please explain about the limitations, i mean which sort of ico on which it will work, coz i tried several exe's from my program files but didnt work on any of them.....may be coz of different sizes, but could you please also attach any sample exe's on which the code is working properly, thanks again once again for sharing such a valuable thing...have a nice day best regards Ibraheem
It will work on any exe but will work on the first Icon that will be replaced but if any exe has 10 blank icons resource it will not work which is commented as well. See Just to prevent from infinite comment. Working sample is already there for you to see and run.
thanks ....but i wsn't still able to change icon of any exe, could you please send me any two exe's just for example, i didn't find any sample exe's to use as source and destination exe's with in your attachments on which it will work......waiting anxiously for your reply.
There is a "Attached Files" section after the article where you should find the sample attachment as well.
i have both of them, one contained the project source while other contains the binary, but there is no sample exe's to use as source and dest on which it will work......
You can keep the exe and its copy and then run the application with the source file as some notepad and the destination one as the copy exe and then it will update the copy exe correctly. It will work on exe which has only one Icon embedded.
yeah...that's why may be its not working with mine ones...but in prof products its rare to hve one icon, and each icon have several images, i'm trying to update one, and playing around with it, but it merges some images of an ico file from destination and some from source in the same ico file.....is it posb to make it work for multiple icon embeded application and to update an ico resource with multiple images in it....thanks for your time
The code can always be updated to change all the icons. I have given here how to do it (a prototype) and it can always be extended. Isn't it?
hmmm..i think soo....by changing these two params, one is the 3rd param of updateresource and other is FindResource 2nd param in source exe, you can browse arount the images placed in that ico file, and replace as you wish them to be, so its working now, but could you give me some hints that instead of source exe, if i have to load an *.ico image file and then replace the resource in the desitnation exe...how it would be...thanks and have a nice day
Dear Shabir i have run ur code to change the icon of an exe file .But i change the icon of an exe file only once.next time u run this code nothing happens(until i restart my computer).in fact in output window a message is displayed which is The therad 'win32 Thread' has exited with code 0 (0*0) The program '[3628]' Exeupdate.exe Native ' has exited with code 0 (0*0) will u plz guide me about this problem.
I am unable to re-create your problem but it looks like the exe file you are trying to change is locked by some process and it may be the ExeUpdater which is used for first time. Check if that is the case.
Let me explain when i run this code then the icon of my exe file flushes once to new ion then again becoms the original icon.(e.g i want to change of msn.exe Icon with yahoo.exe Icon but msn icon again changes to msn Icon).
Try seeing in resource hacker and see if it gets replaced by some icon / icon group and then MSN flushes and shows some other icon group in explorer.