Solved

reading a gif file from .res resource

Posted on 1998-07-09
4
328 Views
Last Modified: 2010-04-04
hi,

I made a res file as follows using brcc32
gif.rc =>
gif gif 0.gif

But I cannot get it to load, I always get a read of adress error. So I must be doing something wrong.
Can anyone show me how to load it.

Procedure Tform1.FormCreate(Sender: TObject);
var
?
begin
?
GifImage1.FileName := ?
end;

Thanks
0
Comment
Question by:hellfire052497
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 3

Expert Comment

by:vladika
ID: 1357466
What is GifImage?
If it is nonstandart component, where can I find it?

0
 
LVL 3

Expert Comment

by:Matvey
ID: 1357467
Vladika, If you go to Torrys page (http://bes.trendline.co.il/torry/), you can find dozens of components that read GIF and all sorts of graphics. I thought that at leas some of them can read files from resources, but I didn't find aything...
0
 
LVL 3

Accepted Solution

by:
vladika earned 100 total points
ID: 1357468
I think you use TGifImage from Torrys page

1) create gif.rc as you write
gif.rc =>
gif gif 0.gif

2) compile it with brcc32 -> you get gif.res
Now gif.res include gif file as resource (type='GIF', name='GIF')

3) create new project and set GifImage on Form1

4) in your program

{$R gif.res}  // include resource into exe - do not forget !!!

procedure TForm1.FormCreate(Sender: TObject);
begin
  GifImage1.LoadFromResourceName(hInstance, 'GIF'); // 'GIF' - resource name
end;

5) also you can use TResourceStream

{$R gif.res}  // include resource into exe - do not forget !!!

procedure TForm1.FormCreate(Sender: TObject);
var RS: TResourceStream;
begin
  RS := TResourceStream.Create(hInstance, 'GIF', 'GIF'); // Name - 'GIF', Type - 'GIF'
  try
    GifImage1.LoadFromStream(RS); // load from resource stream RS
  finally
    RS.Free;
  end;
end;

0
 

Author Comment

by:hellfire052497
ID: 1357469
The first option works. It is easier then I thought. Thanks.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question