Solved

Linking binary Files

Posted on 1998-10-07
10
155 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
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
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
 
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 AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
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…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

770 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