[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

reading a gif file from .res resource

Posted on 1998-07-09
4
Medium Priority
?
344 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 400 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

Tech or Treat!

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

656 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