Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: MoonKid on March 27, 2007, 06:33:57 am

Title: create and use icons with resources
Post by: MoonKid on March 27, 2007, 06:33:57 am
I have never worked with rc-files.

I just want to link (pack) my ico-files into the binary and use them then. How can I include a ico-file in the rc-file and reference it in my application?
Title: Re: create and use icons with resources
Post by: Biplab on March 27, 2007, 08:19:06 am
Create a resource file, e.g., resource.rc and add it to your project.

If you want to add an Icon for your application, then add a line to the resource file similar to the following.
Code
aMAIN ICON "<Path_To_Your_Icon>/<Icon_File_Name>.ico"

Now compile your project and your application will have the icon You've specified.

Regards,

Biplab
Title: Re: create and use icons with resources
Post by: MoonKid on March 27, 2007, 06:15:18 pm
Now compile your project and your application will have the icon You've specified.

Ok, but how can I adress it in my code?
For example:

How can I create a wxIcon object?
Title: Re: create and use icons with resources
Post by: Biplab on March 27, 2007, 06:27:44 pm
Ok, but how can I adress it in my code?
For example:

How can I create a wxIcon object?

Create a sample wxWidgets Project using Wizard of C::B and look into app.cpp file and resource.rc file. You'll understand how it can be implemented. :)

Regards,

Biplab
Title: Re: create and use icons with resources
Post by: MoonKid on March 27, 2007, 06:50:48 pm
Hm... So easy! ;)

I am not sure If I understand the wx-doc right. Is it only under windows and os2 possible to use resources?
How can I pack ico-files to my binary in unix/linux or mac os x applications?
Title: Re: create and use icons with resources
Post by: Biplab on March 27, 2007, 07:09:21 pm
I've not tried in other platforms.

Download the following ebook.
h**p://www.phptr.com/content/images/0131473816/downloads/0131473816_book.pdf

Read the APPLICATION INSTALLATION sub-chapter in chapter 20. There are couple of hints on how to use icons in Linux. Hope it'll help you. :)
Title: Re: create and use icons with resources
Post by: MoonKid on March 27, 2007, 07:43:13 pm
Read the APPLICATION INSTALLATION sub-chapter in chapter 20. There are couple of hints on how to use icons in Linux. Hope it'll help you. :)

Ok, the crux of it for me: Do not use a plattform specific icon-handling like rc-files. I should add icons as extern ico-files to my application. ;)