store image in the executable

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
bayo
In need of some credit
In need of some credit
Posts: 1
Joined: Thu Oct 08, 2009 11:04 am

store image in the executable

Post by bayo »

Hi there

I'am very new in working with wxwidgets and this is my first problem. I try to store an image in the executable because i don't want to load id from the filesystem. I would like to store it in string, base64 encoded and create an image from a string stream. But it does not really work :-(

Did someone else such thing, any experiences?

Thanx for all advices!

Dominic
TrV
Ultimate wxWidgets Guru
Ultimate wxWidgets Guru
Posts: 630
Joined: Wed Jul 04, 2007 1:12 pm

Post by TrV »

You have to create a resources file and list your images. Make some research on this forum, there already are lots of topics about this.
DavidHart
Site Admin
Site Admin
Posts: 4254
Joined: Thu Jan 12, 2006 6:23 pm
Location: IoW, UK

Post by DavidHart »

Hi,

The easiest way, for images that aren't enormous, is to convert your image to an xpm. Then the xpm can be #included. This also has the advantage of being cross-platform.

Many of the samples (that come with the wx source) do this.

Regards,

David
Forest
Knows some wx things
Knows some wx things
Posts: 39
Joined: Fri Feb 06, 2009 3:58 pm

Post by Forest »

I use wxInclude. It can convert many images in various formats to arrays and create header file with them.
You can read http://wiki.wxwidgets.org/Embedding_PNG_Images
Sorry for lame English... :)