Maybe you need to use several JPGs in your application.
Instead of leaving them outside of your executable, with this trick you will be able to include it.
First, we will build ourselves a resource file where we will put the JPG files
To make it it follows the steps that I here put you:
Making our .RC file
Open a text editor (Notepad, by example) and write:
1 RCDATA UnJpg.JPG
2 RCDATA OtroJpg.JPG
Save the file with RC extenxión, for example: Imagenes.RC
Compiling the .RC file
Now we should compile it, to create a file of resources (.RES), for that which, the best thing is that you put in the same directory as much the JPGs as the file .RC that you have created.
To compile the file, we will use the Delphi compiler: the BRC32 (Borland resource Compiler) that you will have in the subdirectory /BIN inside the directory where you have installed the Delphi.
We will use:
BRC32.EXE -r -v Imagenes.RC
If everything has gone well, we will have generated the file Imagenes.RES
Including the .RES file in your application
Now, you should include in your application, the file .RES that you have created. You will make it including this line in your form, in the implementation part:
Showing these JPGs
It was time to show the JPGs:
Los pasos son los siguientes:
Create a temporal TJpegImage (remember add 'JPeg' in the uses)
Create a TResourceStream pointing to the JPG to load (in the example the #1)
Load the JPG in the temporal TJPegImage
Draw the temporal TJPegImage in a TImage of our form
Free the temporals.
procedure TfSplash.FormCreate(Sender: TObject);
Corriente : TResourceStream;
Imagen : TJPegImage;