Author Topic: create and use icons with resources  (Read 5266 times)

Offline MoonKid

  • Almost regular
  • **
  • Posts: 180
create and use icons with resources
« 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?

Offline Biplab

  • Developer
  • Lives here!
  • *****
  • Posts: 1874
    • Biplab's Blog
Re: create and use icons with resources
« Reply #1 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
Be a part of the solution, not a part of the problem.

Offline MoonKid

  • Almost regular
  • **
  • Posts: 180
Re: create and use icons with resources
« Reply #2 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?

Offline Biplab

  • Developer
  • Lives here!
  • *****
  • Posts: 1874
    • Biplab's Blog
Re: create and use icons with resources
« Reply #3 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
Be a part of the solution, not a part of the problem.

Offline MoonKid

  • Almost regular
  • **
  • Posts: 180
Re: create and use icons with resources
« Reply #4 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?

Offline Biplab

  • Developer
  • Lives here!
  • *****
  • Posts: 1874
    • Biplab's Blog
Re: create and use icons with resources
« Reply #5 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. :)
Be a part of the solution, not a part of the problem.

Offline MoonKid

  • Almost regular
  • **
  • Posts: 180
Re: create and use icons with resources
« Reply #6 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. ;)