Solved

Linking binary Files

Posted on 1998-10-07
10
152 Views
Last Modified: 2010-04-06
Hello,
is there anyway in Delphi 4 Standard, to link the following Files direclty into the EXE and then use it at run-time ?

- WAVES (using MediaPlayer)
- ICONS (I didn't see an 'import' menu or something in     ImageEdit)
- FONTS (A TTF-Link would be great, to use for different elements such as StaticText, Label, Edit, RichEdit)

Thanx, Roger ;)
0
Comment
Question by:omsec
  • 4
  • 3
  • 2
  • +1
10 Comments
 
LVL 4

Expert Comment

by:BoRiS
ID: 1342139
omsec

As I understand it you can put them into a resource file and compile the resource into the exe so the files will be available a runtime

You can link all this files and then use brcc32.exe under the bin directory to build a 16 or 32 bit res file and included it in your program...

{$R myres.res}

Later
BoRiS
0
 
LVL 2

Author Comment

by:omsec
ID: 1342140
hmh, this looks like a scripting language or something. Do you have experience with it ? WOuld be very usefull to see an example. if it's that hard, i can increase points...

btw, i this if from Delphi-FAQ at borland's,
i didnt get it to work :

Create a resource file containing the icons you wish to use, then
use the Windows API function LoadIcon(),

Example:

{$R MYRES.RES}

procedure TForm1.Button1Click(Sender: TObject);
var
  h : hIcon;
begin
  h := LoadIcon(hInstance, 'ICON_1');
  Application.Icon.Handle := h;
  InvalidateRect(Application.Handle, nil, true);
end;

i tried different ways
ICON_1, Icon1, Contentents\Icon\Icon1 etc.

thanx
0
 
LVL 4

Expert Comment

by:BoRiS
ID: 1342141
omsec

Have you created the res file with ImageEditor and added an icon called ICON_1 and saved it under your projects directory and called the res file myres.res

The directive

{$R ....} will include the res file specified...

The example from Inprise works fine if all the above is done.

Later
BoRiS
0
 
LVL 2

Expert Comment

by:freter
ID: 1342142
omsec:
you can out virtually anything into a resource. there are, of course special resource trees in an executable for the most common data types like icons, stringlists, accellerators and so on. if you are lookng for an easy way of producing resources, go and get Merlin (website: http://www.boots.com/merlin, also on the superpage: http://sunsite.icm.edu.pl/delphi/ftp/d20share/merlin.zip). this is a set of experts (which for themselves are quite helpful) and a resource editor that allows you to put anything you like into a resource. it also will generate code for loading a resource into delphi.
regds, freter
0
 
LVL 2

Author Comment

by:omsec
ID: 1342143
hm, a quick refernce, an example of an RC-File or a brcc32 HLP would be enough i think, since Delphi 4 standard doesnt come with a such helpfile
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 4

Expert Comment

by:erajoj
ID: 1342144
Hi,
install the RXLib (http://rx.demo.ru/).
In it there is a great resource manager.
Very, very simple to use!

/// John
0
 
LVL 2

Expert Comment

by:freter
ID: 1342145
omsec: give merlin a try. you won't have to struggle with .rc files if you use merlin, since you'll define verything within a gui!
http://www.boots.com/merlin
http://sunsite.icm.edu.pl/delphi/ftp/d20share/merlin.zip

rgds, freter
0
 
LVL 4

Accepted Solution

by:
BoRiS earned 100 total points
ID: 1342146
omsec

here is a quick example of an rc file...

1) Create a wave file called 'click.wav' & 'error.wav' & 'next.wav'
in the project's directory.

2) Create a text file called 'sound.rc'
in the project's directory.

3) Add the following line to the file 'sound.rc':
CLICK WAVE click.wav
ERROR WAVE error.wav
NEXT WAVE next.wav

4) At a dos prompt, go to your project directory
and compile the .rc file using the Borland Resource
compiler (brcc32.exe) by typing the path to brcc32.exe
and giving 'sound.rc' as a parameter.

Then in your project call this...

//remeber to add mmsystem to your uses clause...
 uses
  Windows, Forms, ..., mmsystem;

//then add the res file

implementation

 {$R sound.res}

procedure TForm1.Button1Click(Sender: TObject);
begin
 PlaySound('CLICK', hInstance, SND_RESOURCE or SND_SYNC);
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
 PlaySound('ERROR', hInstance, SND_RESOURCE or SND_SYNC);
end;

and so on...

to add icon's etc just change the wave stuff i gave you...

//example add to .rc file...

NEW ICON 'place.ico'

in code add...

procedure TForm1.Button3Click(Sender: TObject);
begin
 Image1.Picture.Icon.LoadFromResource(hInstance, 'place');
end;

Hope this Helps

Later
BoRiS
0
 
LVL 2

Author Comment

by:omsec
ID: 1342147
i still dunno how to link TTF-Fonts
0
 
LVL 2

Author Comment

by:omsec
ID: 1342148
i didnt found the implementation of PlaySound - Procedure either.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

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…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
I designed this idea while studying technology in the classroom.  This is a semester long project.  Students are asked to take photographs on a specific topic which they find meaningful, it can be a place or situation such as travel or homelessness.…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

947 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

22 Experts available now in Live!

Get 1:1 Help Now