Solved

Linking binary Files

Posted on 1998-10-07
10
150 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

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…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

758 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

19 Experts available now in Live!

Get 1:1 Help Now