Code::Blocks pack images and sounds into .exe?

Hello! I am new to this forum and I am wondering if its possible to compile/pack images and sounds into and .exe file. The reason is because I don't want people stealing my sprites and sounds. Thanks! :)
I believe resource files support sounds & images...
Last edited on
If you use resources then any resource editor can extract them :)

Another approach is to pack all inside a .zip file and use a unzip library to unpack them at runtime. The .zip you embed directly as a C style string (an unsigned char* of known length).
http://www.codeproject.com/Articles/7530/Zip-Utils-clean-elegant-simple-C-Win32
Thank guys! Could someone show me how I can use a resource file with my program?
Or a zip file?
To include resources in Code::Blocks 12.11, add the *.rc file to the project, then rebuld the entire project to update everything. Be sure to include the same resource header in your main *.cpp file and the *.rc file.
Thanks for the info, but I have now decided that I want it to be where I have the .exe then have like .bmps, .wavs, and .maps all packed in a separate file with a .blob extension. (it makes it look more professional)

I dont want to use resources because they only support images, sounds, icons and stuff like that. It has too many limitations for me to use.

Thanks so much everyone :)
I dont want to use resources because they only support images, sounds, icons and stuff like that. It has too many limitations for me to use.


You can use any binary content inside resources, there is no such limitation like that.
Ok I never knew that before, but there is gotta be a way for me to be able to have sounds, maps, images to be packed in files with any extension (.blob, .hogg, etc) with sounds in one, images in one, maps in one, and stuff like that.

Thanks :)
Please help! :(
just use resources :P
Maybe OP want us to write the code for him.
Because I dont know how to do it. I have googled for hours and hours and no results on what i have said here:
there is gotta be a way for me to be able to have sounds, maps, images to be packed in files with any extension (.blob, .hogg, etc) with sounds in one, images in one, maps in one, and stuff like that.


I want to learn how to do it also. But where can I learn it?
You know how to create a .zip file, don't you ? Use 7zip if you don't know how.
http://www.7zip.org/

Then in your program use this code to unpack them at runtime and use it (you can use a password protected archive if you want):
http://www.codeproject.com/Articles/7530/Zip-Utils-clean-elegant-simple-C-Win32

This was already posted, it has example code, what do you expect more ? Programming is not a easy task, you must learn yourself.
I have one modification recommendation for modoran's post: use WinRAR instead of 7Zip.
Topic archived. No new replies allowed.