Solved

How can i change another exe icon??

Posted on 2007-11-20
18
4,100 Views
Last Modified: 2013-11-23
Hello experts,

How can i change another exe icon??
0
Comment
Question by:plinho
  • 10
  • 7
18 Comments
 
LVL 3

Expert Comment

by:Tom-J-Lael
ID: 20324563
Right click .exe file or shortcut to .exe file

select properties

Make sure "shorcut tab" is selected

choose "change icon"

choose your options that are available or browse to a custom ICON file
0
 

Author Comment

by:plinho
ID: 20324833
No, i mean via code, i want to make an application that changes others icons
0
 
LVL 28

Accepted Solution

by:
ciuly earned 500 total points
ID: 20326346
0
 

Author Comment

by:plinho
ID: 20326615
ciuly it isnt necessary madcomponents for this function is it? if not what should i incluse in the uses for TPIconGroup??

and to use it would be just like you posted in that post right?
0
 
LVL 28

Expert Comment

by:ciuly
ID: 20326745
actually, madcomponents are necessary. but only madbasic if I remember correctly.

the only problem is that if you want to change an unkown icon, then you first need to get the language of the icon you want to change. one way is to use madres and iterate through the icons, or use another component/library that does that.

an alternative (good one) is using collin wilson's units: http://www.wilsonc.demon.co.uk/delphi.htm
you can check out xn resource editor from there. it comes with sources.

the only way around not using other peoples units is to use raw winapi. which can be tricky.

and in the matter madres vs wilsonc ... hard to say. I guess it depends on how/where and what for youa re going to use it. OR on personal preference.
0
 

Author Comment

by:plinho
ID: 20326797
Hmm i dont know... what i wanna do is change only the icon of the program itself, i mean in windows explorer, like when you go to Project - Options - Application and change the icon. I mean, jsut this one, it doesnt need to change that little one in the left of form's caption...

What way do you recommend to use??


by the way, i dont really care using others components :p
0
 
LVL 28

Expert Comment

by:ciuly
ID: 20326828
well ... for starters, you cannto do that.

the icon from the left od the form's caption IS the main icon of the application that appears in windows explorer.

so ... you need to rethink this a little :)
0
 

Author Comment

by:plinho
ID: 20326866
hahaha i guess this is a LOT more complicated than i expected ^^

I thought there would be some simple function....

Hmm and to change the own application's icon... i tried Application.icon.loadfromfile something like that... but it only changes the little one in form's caption, the windows explorer's doesnt change :p
0
 
LVL 28

Expert Comment

by:ciuly
ID: 20326892
obviously, since that method changes the icon at runtime, the one that is loaded in memory for the application itself, not the one from the application file which explorer will display.

the problem is this:
do you reall y want to display another icon in the application forms and another in windows explorer?

if so, then change the application main icon in file using my function above and use the application.icon.loadfrom file with teh icon you want displayed in forms.

if this is not what you want, then tell us more exactly what you want to happen, not what you thin you want to do in code ;)
0
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 

Author Comment

by:plinho
ID: 20326936
hahaha ok, here it is: The only thing i want to change is the icon from windows explorer.... the form's icons is irrelevant... Hmm, there is no way to change windows explorer icon while application is active right?

Another thing: if it is a lot easier a function to change the OWN application in delphi will do it xD
Imean, a button in project1.exe that changes project1.exe icon... :p
0
 
LVL 28

Expert Comment

by:ciuly
ID: 20326975
>> Hmm, there is no way to change windows explorer icon while application is active right?

under windows, there isn't :)

>> a button in project1.exe that changes project1.exe icon

as I said above, there is no such method to change a running application content.

but, if the form icon is irrelevant, why not just change the main icon of the project using my function?
0
 

Author Comment

by:plinho
ID: 20327018
because i dont know how to use it :p

that was my first question... and it all ended in the question: "which method you said is easier?"
0
 

Author Comment

by:plinho
ID: 20327338
I'm downloading madcomponents now ;)
i'll install it and test your function
0
 
LVL 28

Expert Comment

by:ciuly
ID: 20327385
>> because i dont know how to use it :p

the usage is quite simple and strait forward. you also have a test project in that PAQ.
you want me to copy paste what is tehre, here? it makes no sense to me, but if that is what you want I can do it. (retorical)

so, after you have installed at leasy madbasic, copy that function (the version from the accepted solution) to your unit and call it with the parameters you need (exefile, icon, etc).
and keep in mind that you cannot change the icon of a running appilcation.
0
 

Author Comment

by:plinho
ID: 20327517
Hmm when i tested it i got an error Oo

it says: Access violation at address 0044F66D in module 'Project1.exe'.

i used like this: UpdateExeIcon('project2.exe', 'MAINICON', 'myicon.ico', 0);
0
 

Author Comment

by:plinho
ID: 20327532
Whow never mind, i typed the icon name worng :p

it worked perfectly!!!

Thanks ciuly
0
 

Author Closing Comment

by:plinho
ID: 31410262
Genius
0
 
LVL 28

Expert Comment

by:ciuly
ID: 20327573
you're welcome :)
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

In our object-oriented world the class is a minimal unit, a brick for constructing our applications. It is an abstraction and we know well how to use it. In well-designed software we are not usually interested in knowing how objects look in memory. …
Jaspersoft Studio is a plugin for Eclipse that lets you create reports from a datasource.  In this article, we'll go over creating a report from a default template and setting up a datasource that connects to your database.
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now