Solved

Resource files and Metafiles

Posted on 2000-05-07
12
278 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
ScreenConnect 6.0 Free Trial

Discover new time-saving features in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

 
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
 
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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

803 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