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.
Thread 'Project Documentation'
Trying to package up a small bank account manager project that I have been tempering on for a while. One that is certainly worth something to me. Although I have created methods to whip up quick documents with all fields and properties. I would like something better to reference in order to express the mechanical functions. It is unclear to me about any standardized format for code documentation that exists. I have tried object orientated diagrams with shapes to try and express the...
Back
Top