Solved

Resource files and Metafiles

Posted on 2000-05-07
12
275 Views
Last Modified: 2010-05-18
I need to compile several metafiles (*.emf) into a resource file and then load them into a TPicture from within Delphi. How do I do it? presumably I use brcc32.exe to compile the .res, but what formats do I have to use, and how to I get TPicture.Metafile to load from the resource?

  Cheers, Steven
0
Comment
Question by:StevenB
  • 5
  • 3
  • 3
  • +1
12 Comments
 
LVL 20

Expert Comment

by:Madshi
ID: 2787344
I'm no expert in these things. But here you'll find some tips about resource files in general:

http://www.bhnet.com.br/~simonet/

Regards, Madshi.
0
 
LVL 15

Expert Comment

by:simonet
ID: 2787370
Hello, Steven

Can you send me a couple EMF files so I can build a demo application for you?

simonet@bhnet.com.br

Alex
0
 
LVL 15

Expert Comment

by:simonet
ID: 2787372
simonet changed the proposed answer to a comment
0
 
LVL 27

Accepted Solution

by:
kretzschmar earned 500 total points
ID: 2787389
hi stevenB

a sample

creating a resource like

EMF1 METAFILE "MS.EMF"
(Name Typ Filename)
(saved as EMFRES.RC)

compile it with brcc32
add it to your unit

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

use this sample code for display

procedure TForm1.Button1Click(Sender: TObject);
var RStream : TResourceStream;
begin
  RStream :=TResourceStream.Create(HInstance,'EMF1','METAFILE');
  try
    image1.Picture.Metafile.LoadFromStream(RStream);
  finally
    RStream.Free;
  end;
end;

meikl
0
 
LVL 4

Author Comment

by:StevenB
ID: 2787404
Sent them,

  did they arrive?
0
 
LVL 4

Author Comment

by:StevenB
ID: 2787432
Thanks meikl,

  works perfectly, Sometimes the solution is painfully simple. Cheers for the quick response everybody. Simonet, if you spend time working on an example for me before finding that the questions closed, then post a comment and I'll throw you some points. I'm loaded with 'em anyway :o)

  Steven
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 15

Expert Comment

by:simonet
ID: 2787442
Steve,

I just sent you the Zipped demo to you, via e-mail, with full source code.

The actual code that I sent you was taken from Resource Explorer, which is available from my site (Madshi gave you the address).

Yours,

Alex
0
 
LVL 15

Expert Comment

by:simonet
ID: 2787444
Meikl.. Grrrrrr.
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 2787494
oops, alex,
don't annoy you at me :-(

steven,
glad to helped you,
thanks for for accepting
my comment as an answer.

guessing that alex sended sample shows
more explaination about how to do.

good luck again

meikl
0
 
LVL 15

Expert Comment

by:simonet
ID: 2787502
>don't annoy you at me :-(

What????
Sometimes I don't know why I even bother...
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 2787522
? seems that the babelfish-translator from altavista mixed something, therefore next try in free words

alex, don't be angry about me

meikl ;-)
0
 
LVL 4

Author Comment

by:StevenB
ID: 2790797
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

708 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now