Assign Icon

I want to get the icon from one exe file and assign it to another using win32 api (beginupdateresource, updateresource, endupdateresource) or some other way. I want to do it in run time. Updateresource is working for text kind of resources. But when i try to do it for icon, the new exe file says the format is not correct or something. Can anyone help me on this?

Thank you,
Chester.
LVL 6
Chester_M_RagelAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

armoghanCommented:
Above link is to get the icon of an Exe
for assigning some exe another icon
see this link, it is in delphi but you may be able to use the DLL
http://www.experts-exchange.com/Programming/Programming_Languages/Delphi/Q_20598186.html
0
armoghanCommented:
also see this article, it is using BeginUpdateResourceW, UpdateResourceW and EndUpdateResourceW API
http://www.codeproject.org/dotnet/dotNetInstaller.asp
0
Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

Chester_M_RagelAuthor Commented:
Hi Moghan,

I don't want to use some other dll to do this stuff. I went thro Mad* s MadRes (delphi one).. But i think it must be possible to do it without using that, by just using windows api. Also I want to assign an icon in file1.exe to file2.exe. Normally I can add resource with updateresource. But when it comes to icon(b'cos of compersion which they use) it is giving some problem.
0
armoghanCommented:
0
Chester_M_RagelAuthor Commented:
Actually I was searching for this for more than two weeks... I went thro all MSDN documentations... I know how to access resources, icons.. the problem is writing them to another file. Actually i can even write them, but when i try that for icons after adding that and try to access the icon, it is saying the resource format is not in correct format....
0
armoghanCommented:
sorry :( ,
I have not gone through that much detail, just used once to read the icons. never wrote them.

If you get the solution for the compression problem do post it here as well
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Chester_M_RagelAuthor Commented:
Even though this is not the answer what I actually looked for..... At last I found that can use GROUPICON,ICONDIR and ICONENTRYDIR to get the icons by passing correct icon :(. Even though SHFILEINFO can be used to get System and Shell Icon but not the ID which I really wants. Anyway, I'm going to give you the points b'cos I didn't get any reply from anyone here for some time and I don't have any hope in getting one either. Thanks for your interest.

Chester.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C#

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.