Thread: Compiling images into DLL/EXE?

  1. #1
    Registered User
    Join Date
    Apr 2006
    Posts
    137

    Compiling images into DLL/EXE?

    Well right now i know how to create a JPG image and stick it onto my program using a library i found online.

    Now the problem is, i have to carry the JPG files around with the EXE file.

    So i'm wondering if there's a way to compile a DLL or EXE that has compressed JPGs or GIFs inside!

    I read in some VB forum that it's possible.

    I'm using Dev C++.

    I looked around in google and found nothing.

    On a side note:: Is there a way to make like a white background transparent to the window of the application? (Such as an option to change a jpg file so that only white color becomes transparent or same color as window)
    Last edited by execute; 05-02-2006 at 03:49 PM.

  2. #2
    Registered User
    Join Date
    Mar 2005
    Location
    Mountaintop, Pa
    Posts
    1,058
    Check this thread out http://cboard.cprogramming.com/showthread.php?t=75180
    There is a complete example somewhere in that thread to embed a text file in a executable. In your situation, you'll be embedding a JPG file
    Your resource file will look something like this:
    Code:
    #define IDB_MYJPG   1000
    IDB_MYJPG              BINARY                  "res\\myjpg.jpg"

  3. #3
    Registered User
    Join Date
    Sep 2003
    Posts
    224
    In order to get images on to a GBA ROM, beginners usually store the image inside a .C file, and link the object along with the entire ROM. You could probably do the same thing. The problem is that if the image is too big, the compiler will bomb out (Unix will run out of swap space and on Windows, the compiler, in my case MinGW, will just fail to malloc() any more memory).

  4. #4
    Registered User
    Join Date
    Sep 2003
    Posts
    224
    I meant store the image as an array in a .C file.

  5. #5
    Registered User Tonto's Avatar
    Join Date
    Jun 2005
    Location
    New York
    Posts
    1,465
    Well you could do that, but I don't know why. You could practically use the resource as an array. Understand that just because you see a file name there, doesn't mean you need to distribute it to clients. It is compiled into the binary, and you can access it using some resource API's.

  6. #6
    Registered User
    Join Date
    Apr 2006
    Posts
    137
    Code:
    #define IDB_MYJPG   1000
    IDB_MYJPG              BINARY                  "res\\myjpg.jpg"
    i know this part. I believe i have to use findresource, loadresource, lockresource, but then what? How do i load the image???

    Can anyone write me a quick function (without checks, i can do checks myself and error msgs), just to show me the use of Find,load,lock and then how to finally display the JPG img??? I know bitmaps but, this is a little more complicated i think.

    Do i have to use a listview box or whatever like some JPG libraries?????

  7. #7
    Registered User kryptkat's Avatar
    Join Date
    Dec 2002
    Posts
    638
    i do this.

    hbmKat = LoadBitmap(GetModuleHandle(NULL), MAKEINTRESOURCE(IDB_KAT));

    under winproc and under wm_create then under em_paint do your stuff

  8. #8
    Registered User
    Join Date
    Apr 2006
    Posts
    137
    LoadBitmap LoadImage, won't work with JPGs i dont think.

  9. #9
    Registered User
    Join Date
    Mar 2005
    Location
    Mountaintop, Pa
    Posts
    1,058
    LoadBitmap LoadImage, won't work with JPGs i dont think.
    Won't work with either JPEG's or GIFs. You'll have to use the IPicture interface to display these images.

  10. #10
    Registered User
    Join Date
    Apr 2006
    Posts
    137
    Ok after a couple hours of wasting my time, the only ipicture library i found is for microsoft visual C++... and im not going to use that program, because i like my DevC++.... Can you give me a library that has all the FindResource,Load,Lock implemented?

    Without giving me links that have to do with VC++ (i have it, but i dont like it).

    Right now the only thing i can do is load an image into a listview's background and use that like an image placeholder, but that only accepts Full path's as a path to image, it doesn't let me use a resource int.

  11. #11
    Registered User
    Join Date
    Apr 2006
    Posts
    137
    Ok i need a JPG library that doesn't require VC++ and that isn't too big, just to display a JPG by accepting MAKEINTRESOURCE(IDB_MYJPG);

  12. #12
    Registered User
    Join Date
    Apr 2006
    Posts
    137
    wow i hate these JPEG libraries in the internet... CxImage etc... they give you unclear instructions, and expect you to figure out the rest. They give you a snippet like a clue, and expect you to know... :/

  13. #13
    Registered User
    Join Date
    Apr 2006
    Posts
    137
    Anyway, i guess there is no good library or anything where we can simply put JPG images and compile it in a resource file.

    So i'm just going to link it online.

  14. #14

  15. #15
    Registered User
    Join Date
    Apr 2006
    Posts
    137
    Well i don't think that will work out either... as there is no download thing. I just need a library that will take a RESOURCE of the JPG... and then make left,top,width,height... and place a jpg... why is this so hard to code????

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 02:39 PM
  2. Images
    By gvector1 in forum C++ Programming
    Replies: 7
    Last Post: 02-25-2003, 09:59 AM
  3. images, icons, and cursors, OH MY!
    By DarkViper in forum Windows Programming
    Replies: 3
    Last Post: 01-07-2003, 02:26 PM
  4. STL, Queues And Images
    By simly01 in forum C++ Programming
    Replies: 3
    Last Post: 06-24-2002, 12:31 PM
  5. A simple question on Images....
    By LonelyPlanetWa in forum C Programming
    Replies: 7
    Last Post: 05-20-2002, 07:34 AM