|
-
April 23rd, 2009, 08:16 AM
#1
Img inside the code
Hello all!!
I have to code an .EXE app that loads an image and opens it with the default image handler of the system. Something like, two clicks on the .EXE program, it opens with an invisible window, copy the image from the code to the hard disk (or something like this), open this image and close itself.
I know that this can be made with a big array of bytes, loaded into a buffer, etc.
This is ok, but, when I need to change the image, it is not practical to change the entire buffer (hard coded into the code), compile again, and so on.
There is some way, to just add the image to some project and compile the program?
I'm actually a Java programmer, who needs to make this thing work =), so I'm using the C++ interface of netbeans.
I've searched the forum and didn't find more information about this kind of thing I need.
Can someone give me directions for this?
Thank you very much!
-
April 23rd, 2009, 09:37 AM
#2
Re: Img inside the code
Well, of course you can write a program to take an image and generate a cpp file containing an array corresponding to it. That's the best I can think of.
-
April 23rd, 2009, 10:24 AM
#3
Re: Img inside the code
There are actually programs out there for you that already do that. GIMP comes to mind, from GIMP you can save as C code, C code works very nicely in C++.
-
April 23rd, 2009, 12:26 PM
#4
Re: Img inside the code
You caould add that image to your project's resource file, load it from resources at runtime and write to disk as a file.
Vlad - MS MVP [2007 - 2012] - www.FeinSoftware.com
Convenience and productivity tools for Microsoft Visual Studio:
FeinWindows - replacement windows manager for Visual Studio, and more...
-
April 24th, 2009, 08:03 AM
#5
Re: Img inside the code
 Originally Posted by VladimirF
You caould add that image to your project's resource file, load it from resources at runtime and write to disk as a file.
Hi!
But if I add to the project it will be placed somewhere inside the .EXE file?
My go is to have one single .EXE file with all the stuff inside it.
I tryed to to this, but the compiler doesn't seem to find the file, it always create another file in the root of the project...
Thank you very much for the answers!!
-
April 24th, 2009, 09:29 AM
#6
Re: Img inside the code
Use the char array spit out by gimp. That makes it much faster since there is no load time (but it will make your program start up slower.
-
April 24th, 2009, 12:29 PM
#7
Re: Img inside the code
Hey, thanks everyone!
You helped me a lot!
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|