This site is temporarily down. Please come back. Include a JPEG in your EXE file
DelphiFAQ Home Search:

Include a JPEG in your EXE file

 

comments6 comments. Current rating: 4 stars (1 votes). Leave comments and/ or rate it.

  1. Create a resource script file MyPic.RC with Notepad and add the following line:
    1  RCDATA  "Pic.jpg"
  2. Then use Borland's Resource Compiler BRCC32.EXE (a commandline tool)
    to compile it into a .RES file:
    BRCC32 MyPic.RC
  3. Add a compiler directive to the source code of your program.
    It should immediately follow the form directive, as shown here:
    {$R *.DFM}
    {$R MyPic.RES}
Use the following code in your application:

procedure LoadJPEGfromEXE;
var
  MyJPG : TJPEGImage; // JPEG object
  ResStream : TResourceStream; // Resource Stream object
begin
  try
    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!
  finally
    MyJPG.Free;
    ResStream.Free;
  end;
end;  // procedure

Content-type: text/html

Comments:

2006-01-27, 05:21:48
anonymousPDA from Hungary  
BRCC32.EXE is not included in BD7 trial...
Where can I find it?
2006-02-05, 18:49:18
anonymous from Colombia  
Same question here...
2006-02-05, 23:21:06
ptiemann_2000@yahoo.com from United States  
Guys if you would leave an email address, I could help you out with BRCC32.exe
You can see my email up there..
2007-02-09, 22:15:52
[hidden] from India  
how do you create a resource script file? and what is it? isnt there a simple way to embed a .exe file in a jpeg picture file ?
2008-04-05, 15:17:59
anonymous  
what H-language is that?

 

 

NEW: Optional: Register   Login
Email address (not necessary):

Rate as
Hide my email when showing my comment.
Please notify me once a day about new comments on this topic.
Please provide a valid email address if you select this option, or post under a registered account.
 

Show city and country
Show country only
Hide my location
You can mark text as 'quoted' by putting [quote] .. [/quote] around it.
Please type in the code:

Please do not post inappropriate pictures. Inappropriate pictures include pictures of minors and nudity.
The owner of this web site reserves the right to delete such material.

photo Add a picture: