How can I add an icon to my MinGW compiled program for Windows?

  • Thread starter Thread starter Coin
  • Start date Start date
AI Thread Summary
The discussion revolves around developing a program for both Macintosh and Windows platforms, with the developer successfully compiling Windows .exe files on a Mac using MinGW. The main challenge is embedding an icon into the Windows executable. The developer seeks a method to associate a .ico file with the .exe without access to Windows' typical GUI options. Suggestions include using Windows API functions like LoadIcon and including the icon as a resource file in the project. Ultimately, the developer finds a solution through online resources that guide the process of using command line tools to embed the icon correctly.
Coin
Messages
564
Reaction score
1
Okay, here's one.

- I'm developing a program for macintosh+windows.
- But, I myself am on a macintosh.
- So, I installed MinGW on my mac. Now, I can compile Windows .exes sitting here on my macintosh. (This part already works.)
- But I can't figure out: How do I give my program an icon?

I have here a .ico I made, but I don't know how to associate it with or embed it into my Windows .exe. I don't really know how Windows icons work. Is there a way to do this using mingw or any open source tool I can run on my mac? (I.E. what I'm trying to do somehow prep the exe is so that when I zip it up and send it over to a windows machine, the windows user will see the icon immediately.)
 
Technology news on Phys.org
It is a GUI app or Console app?
You should try some windows API function such as LoadIcon. You should read books such as <<windows programming>> by Charles Petzold.
 
It is a normal type gui app.

I'm not sure what you mean about the API? I don't mean I want to change the icon at runtime, I mean like I want some file to be the program's icon even before it launches and I can't do the normal thing of right click->properties because I'm not actually on windows myself.
 
Oh, I'm using code::blocks and Mingw under windows, so, with application wizard, it is easy to generate a gui application.
You can use include an icon file as it's resource file.
That all I know.
 
OK. Thanks for the help.

It turns out that the correct answer if you're limited to the command line tools is to http://www.cyrocom.co.uk/tutorials/cpp/icon.html . I got it working using this.
 
Last edited by a moderator:
Hi. Actually the http://blog.stranadurakov.com/2009/04/27/icon-and-version-information-resource-file/" is pretty easy.
 
Last edited by a moderator:
Thread 'Is this public key encryption?'
I've tried to intuit public key encryption but never quite managed. But this seems to wrap it up in a bow. This seems to be a very elegant way of transmitting a message publicly that only the sender and receiver can decipher. Is this how PKE works? No, it cant be. In the above case, the requester knows the target's "secret" key - because they have his ID, and therefore knows his birthdate.
I tried a web search "the loss of programming ", and found an article saying that all aspects of writing, developing, and testing software programs will one day all be handled through artificial intelligence. One must wonder then, who is responsible. WHO is responsible for any problems, bugs, deficiencies, or whatever malfunctions which the programs make their users endure? Things may work wrong however the "wrong" happens. AI needs to fix the problems for the users. Any way to...
Back
Top