Integrating an image into my executable file - c++

I have an application that relies on many images. I have no problem loading the images on to the window. I would like to make my application have the images integrated into it where there are no actual image files in the folder. Also, I would like to know how to do this, because if I sell the application I don't want the user to be able to go to the directory my .exe is located in an get the image file (I am aware that they can print screen it). So, how can I integrate the image into my application. I am using the WinAPI with C++.
I have searched this multiple times and have not found anything on this. I have found one question on another forum, but it was asked a long time ago and was not answered. I did find one other place that had this, but It did not specifically work with my question.

You can bind images (as well as pretty much any pieces of data) as resources to your binary.

Related

Do I have to do something special to make a file a resource file in QT C++?

Basically I have an image I'm trying to use as a splash screen. I set up the splash screen and even told it the location(":/Nuclear_Vortex_100_About.jpg") but when I run the program, all I see is a general window background "window"(no close box or any of the decoration, just a widget for lack of a better word) and no image on it.
I added the file (along with a bunch of other images I want to later load and use in the app) and they show up in the "Other Files" folder - ok so I figured since they're in the project, that they would be seen as resources if not source or headers. Do I need to add a special section to the PRO file or something in order to use the file? I'm about to just hard code an absolute path just to get it to work but I want a system independent way to get this done. I'm going to be paid for this project and I don't have much experience with the resource system in QT but it wasn't hard in Visual Studio and other C++ environments. As I see the splash screen show up, I know that part is working. The only thing I don't know for sure is that the file is not being found - that is I have not verified by using QFile and checking if it exists - I'll be doing that after I post this as it'll take some time to get a response or 2.
I have been searching for over a day and a half all over google and haven't found anything telling me what I'm doing wrong.
Thank you!
create resource file (.qrc) and add picture in it. It'll appear in resources section of your project. Then you can use it freely in your program.

Is there a way to write to a file in online CMS from a local C++ program?

I created a very customized leaflet map on a Bitrix website (they forced me to, not my choice). Now other coworkers who are basically "afraid" of code need to be able to add markers to that. I already created a C++ program where they can simply enter all the details they want (what category, whats the popupcontent etc.) and it spits out the geoJSON code for the marker for them to copy and paste into the website.
To make it even more easy for them I am wondering if there is a way to basically have my program connect to the internet, go to the backend of my website and, after asking for login, adds the code to the respective .js file that contains only the marker code.
I have been googling the problem but unfortunately couldnt find any other related posts.
Okay I finally found the I guess easiest way, I will force my colleagues to install python and write a little thingy to concatenate the code and upload it using Selenium. Thanks for your help guys!

Where to put assets in xcode? [duplicate]

This question have been asked numerous times, but I have not managed to get an answer that I am happy with. Probably because the most answers is of "how do I do this?" type and also get "this way you do this" answers.
The problem I have is that I need to use absolute paths when I want to reference to images in Xcode (version 6.0.1). I am quite sure that I could place the images in my working directory which is something like:
/Users/patrikek/Library/Developer/Xcode/DerivedData/ChessGame-
ftpbqerfsenxxbfvneyzfwdmtwjk/Build/Products/Debug
Then add the file to some Xcode group in project navigator (eg. images/myImg.png) and I would be able to reference the file as myImg.png (since I have not foldered the image inside my working directory). I am also quite sure that the project navigator stuff would not b required for this to work.
And after this introduction comes the questions:
1) Is it necessary to place all images and other resources in the current working directory? Also, if not what is the best way to store folders in a program and is it necessary to name the folder containing images to Resources?
2) Is it possible to arrange files using the project navigator? What I am after is to use the project navigator only and let Xcode worry about the details of copying files and so. It seems somehow unnecessary to have a project navigator, when the physical files are not packaged in the same way. It does also seem error prone to update the project navigator and the physical hierarchy independently of each other.
An example:
I create a folder images in the Project navigator, inside that folder am I placing a reference to the image using the usual way in the project navigator. Is it now possible to make Xcode arrange so that I can do a call images/myImg.png when I want to load the image in some function (without me doing anything, since if I move many images to my working directory I may forget one and I may also spell images wrong by mistake if I create another folder in my working space). Also what have happened inside Xcode when this action was done?
Since I am not at all familiar with Xcode yet I may have got something wrong here, but the core of this problem is to find out where the files physical location must/should be and if there is some way to let Xcode do this by using the project navigator.
BR Patrik
Xcode does not manage images the way you have presumed that it does. Take a look at the 2013 WWDC "What's New in Xcode" video to see how Xcode 5 and Xcode 6 organize and manage images for any given project. When you have configured the asset catalogues for your project correctly, it wouldn't matter where the original images live on disk. As long as you have dragged the right assets into the right catalogues, your projects will work. The good news is that you only need to configure images once and change only the ones that change once done. For details, see this wwdc video: http://devstreaming.apple.com/videos/wwdc/2013/400xex2xbskwa5bkxr17zihju9uf/400/ref.mov
Once an image is configured in the asset catalogue, you can refer to it with or without it's file extension. For example, you can refer to "example.png" as "example" in your code. Hence, "myImg.png" can be "myImg" or "myImg.png" in code. No need to worry about which subdirectory contains it.
Now if your question has to do with runtime assets, again your development system directory structure would not matter. If that is the case, then you might have to re-ask your question. I would be glad to help you there as well--if that's what you want to know.

Allegro 5 ALLEGRO_BITMAP to text file

I'm currently working on a video game project in C++ using Allegro 5 as my graphics library. I store my graphic and font assets in subfolders within the root folder of the .exe. To use them in the program, I have an initGraphics() function that loads all the required assets through al_load_bitmap(), and then later free up the memory with al_destroy_bitmap(). This means however that when I eventually distribute my game, it'll be super easy for anyone to go into the install folder and just edit the graphics to be whatever, and I'm having trouble finding any kind of help regarding how to prevent this.
What I was thinking maybe is some kind of program that I'd run on my own computer before distribution that loads the appropriate graphical assets, and somehow converts them into a .txt file, then changing the main game executable's 'initGraphics()' function to load and use those instead of just the raw .png files, but I'm not sure if this is possible. Any information about this type of conversion would be hugely appreciated, or alternatively a more reliable tested method that achieves the same effect. Thank you very much in advance!
While researching the internet I've found interesting solution:
Allegro5 uses PhysicsFS library to handle file archives. It does not support password protected archives, but you can calculate md5 for your assets archive and hardcode it into your program and then compare it on runtime (source - see more here).
See this part of documentation of Allegro5.
Example explanation of md5 implementation is here

How to reference to images and other objects in Xcode and where to place them physically?

This question have been asked numerous times, but I have not managed to get an answer that I am happy with. Probably because the most answers is of "how do I do this?" type and also get "this way you do this" answers.
The problem I have is that I need to use absolute paths when I want to reference to images in Xcode (version 6.0.1). I am quite sure that I could place the images in my working directory which is something like:
/Users/patrikek/Library/Developer/Xcode/DerivedData/ChessGame-
ftpbqerfsenxxbfvneyzfwdmtwjk/Build/Products/Debug
Then add the file to some Xcode group in project navigator (eg. images/myImg.png) and I would be able to reference the file as myImg.png (since I have not foldered the image inside my working directory). I am also quite sure that the project navigator stuff would not b required for this to work.
And after this introduction comes the questions:
1) Is it necessary to place all images and other resources in the current working directory? Also, if not what is the best way to store folders in a program and is it necessary to name the folder containing images to Resources?
2) Is it possible to arrange files using the project navigator? What I am after is to use the project navigator only and let Xcode worry about the details of copying files and so. It seems somehow unnecessary to have a project navigator, when the physical files are not packaged in the same way. It does also seem error prone to update the project navigator and the physical hierarchy independently of each other.
An example:
I create a folder images in the Project navigator, inside that folder am I placing a reference to the image using the usual way in the project navigator. Is it now possible to make Xcode arrange so that I can do a call images/myImg.png when I want to load the image in some function (without me doing anything, since if I move many images to my working directory I may forget one and I may also spell images wrong by mistake if I create another folder in my working space). Also what have happened inside Xcode when this action was done?
Since I am not at all familiar with Xcode yet I may have got something wrong here, but the core of this problem is to find out where the files physical location must/should be and if there is some way to let Xcode do this by using the project navigator.
BR Patrik
Xcode does not manage images the way you have presumed that it does. Take a look at the 2013 WWDC "What's New in Xcode" video to see how Xcode 5 and Xcode 6 organize and manage images for any given project. When you have configured the asset catalogues for your project correctly, it wouldn't matter where the original images live on disk. As long as you have dragged the right assets into the right catalogues, your projects will work. The good news is that you only need to configure images once and change only the ones that change once done. For details, see this wwdc video: http://devstreaming.apple.com/videos/wwdc/2013/400xex2xbskwa5bkxr17zihju9uf/400/ref.mov
Once an image is configured in the asset catalogue, you can refer to it with or without it's file extension. For example, you can refer to "example.png" as "example" in your code. Hence, "myImg.png" can be "myImg" or "myImg.png" in code. No need to worry about which subdirectory contains it.
Now if your question has to do with runtime assets, again your development system directory structure would not matter. If that is the case, then you might have to re-ask your question. I would be glad to help you there as well--if that's what you want to know.