Go4Expert

Go4Expert (http://www.go4expert.com/)
-   MFC (http://www.go4expert.com/articles/mfc-tutorials/)
-   -   Change Icon of EXE file through code extracting it from other EXE file (http://www.go4expert.com/articles/change-icon-exe-file-code-extracting-t643/)

shabbir 13Dec2006 11:21

Re: Change Icon of EXE file through code extracting it from other EXE file
 
Quote:

Originally Posted by JohnnyH
I have implemented some code that does something similar to your example above except that it copies Version information from one executable's resource information into another executable's resource information. It works as long as both the source executable and destination executable have resource files compiled into them. But the problem I am having is that if the destination executable (the one I want to copy the resources into) does not already have a resource file compiled into it the copy action appears to work (all functions return successfully) but the target executable is no longer runable and the version information that I tried to copy into it is not retrievable. Do you know if it is possible to copy an executable's resources into another executable if the destination executable doesn't have a resource file compiled into it?

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

JohnnyH 13Dec2006 21:29

Re: Change Icon of EXE file through code extracting it from other EXE file
 
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

shabbir 14Dec2006 06:16

Re: Change Icon of EXE file through code extracting it from other EXE file
 
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.

jackl007 11Aug2007 00:12

Re: Change Icon of EXE file through code extracting it from other EXE file
 
what happend with the complete proyect.. i want to changer the icon from a EXE using my EXE.

shabbir 11Aug2007 10:11

Re: Change Icon of EXE file through code extracting it from other EXE file
 
Quote:

Originally Posted by jackl007
what happend with the complete proyect.. i want to changer the icon from a EXE using my EXE.

I could not get you? Can you please explain a bit more.

ibraheempindi 23Aug2007 01:58

Re: Change Icon of EXE file through code extracting it from other EXE file
 
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

shabbir 23Aug2007 08:22

Re: Change Icon of EXE file through code extracting it from other EXE file
 
Quote:

Originally Posted by ibraheempindi
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.

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.

Quote:

Originally Posted by ibraheempindi
could you please also attach any sample exe's on which the code is working properly,

Working sample is already there for you to see and run.

ibraheempindi 23Aug2007 13:27

Re: Change Icon of EXE file through code extracting it from other EXE file
 
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.

shabbir 23Aug2007 17:12

Re: Change Icon of EXE file through code extracting it from other EXE file
 
There is a "Attached Files" section after the article where you should find the sample attachment as well.

ibraheempindi 23Aug2007 17:18

Re: Change Icon of EXE file through code extracting it from other EXE file
 
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...... :rolleyes:


All times are GMT +5.5. The time now is 13:31.