Delphi Tips&Tricks News   Tips   .NET Software   VCL Software   Search   Contacts
Ultimate Pack - special offer!

Ultimate Pack  hot!
Image Editor  new!
Runtime Fusion
Form Designer
Object Inspector
Print Suite Pro
Commented Image
Delphi Toys
WinDowse
Delphi Bonus
TMS Scripter Studio
Form Designer VB
Form Designer .NET

...get more...
for Delphi.NET, C#, VB.NET
for Delphi VCL, BCB 3-6

WinAPI Online
Unix Manual Pages
MegaDetailed.NET
in3steps.com
cdtrrracks.com new!

Blogspot  greatis.blogspot.com

Include jpeg as a resource in *.exe - Resource - Tips & Tricks - Greatis Delphi Pages

For including jpeg as a resource in *.¥å¥ the construction {$R MyRes.RES} is necessary.
For causing from a resource jpeg is necessary to create an object of TResorceStream type and to load jpeg with LoadFromStream procedure.
There is a 'HELP' section which contents a jpeg file in the resource file.


{$R MyRes.RES}
{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);
var
  MyRS: TResourceStream;
begin
  try
    MyRS:=TResourceStream.Create(HInstance, 'HELP', RT_RCDATA);
    Image1.Picture.LoadFromFile('example.jpg');
    if Image1.Picture.Graphic is TJPEGImage then
      TJPEGImage(Image1.Picture.Graphic).LoadFromStream(MyRS);
  finally
    MyRS.Free;
  end;
end;
Related topics
Load bitmap from resource DLL
Play wav sound from a resource file
Include font from from a resource file

For more
Delphi Help

Download source