Include a JPEG in your EXE file (Views: 101)
Include a JPEG in your EXE file
Create a resource script file MyPic.RC with Notepad and add the following line:
1 RCDATA "Pic.jpg"
Then use Borland's Resource Compiler BRCC32.EXE (a commandline tool) to compile it into a .RES file:
Add a compiler directive to the source code of your program. It should immediately follow the form directive, as shown here:
Use the following code in your application:
MyJPG: TJPEGImage; // JPEG object
ResStream: TResourceStream; // Resource Stream object
MyJPG := TJPEGImage.Create;
ResStream := TResourceStream.CreateFromID(HInstance, 1, RT_RCDATA);
MyJPG.LoadFromStream(ResStream); // What!? Yes, that easy!
Canvas.Draw(12, 12, MyJPG); // draw it to see if it really worked!
end; // procedure
<< Back to main page