Is it possible include images (jpegs) as resources in a win32 c++ executable? If so how?
相关问题
- Sorting 3 numbers without branching [closed]
- How to compile C++ code in GDB?
- Why does const allow implicit conversion of refere
- thread_local variables initialization
- What uses more memory in c++? An 2 ints or 2 funct
相关文章
- 如何让cmd.exe 执行 UNICODE 文本格式的批处理?
- 怎么把Windows开机按钮通过修改注册表指向我自己的程序
- Warning : HTML 1300 Navigation occured?
- Class layout in C++: Why are members sometimes ord
- How to mock methods return object with deleted cop
- Which is the best way to multiply a large and spar
- C++ default constructor does not initialize pointe
- Selecting only the first few characters in a strin
Here's the MSDN documentation about resource files.
http://msdn.microsoft.com/en-us/library/aa380599(VS.85).aspx
If it's Windows only then use a custom resource. If you want something cross-platform then do what I did for a recent project - create an app that will encode the JPEG as a
char*
buffer in a header file and then include these headers in your main project. You will also need to store the size of the buffer as it will be sure to contain NULs.For example, I have an app that you can pass a load of files to be encoded and for each file you get a header file that looks something like this:
The app has to escape special non-printable chars in
\x
format, but it's pretty simple. The app uses theboost::program_options
library so a list of files to encode can be stored in a config file. Each file gets its own header like similar to the above.However, be warned - this only works for small files as some compilers have a limit on the maximum size a static char buffer can be. I'm sure there are other ways to do this but this scheme works for me (a C++ web app that stores the HTML, CSS, JavaScript and image files in this way).
Maybe this is what you're looking for?