Delphi Tips&Tricks News   Tips   .NET Software   VCL Software   Search   Contacts
Ultimate Pack Special Offer!


Share this page

Follow us
LinkedIn Blogspot Twitter Facebook

Related products
Ultimate Pack  hot!
iGrid Plotter  new!
Image Editor
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
Print Suite .NET
Gradient Controls .NET  new!

Related links
Win32.hlp online version
MegaDetailed.NET
Delphi to C#

Special
Free Software Promotion
Offers for Resellers

Hobby projects
cdtrrracks.com
books.storrre.com
in3steps.com
sovietphillumeny.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