Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Linking binary Files

Posted on 1998-10-07
10
Medium Priority
?
171 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
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…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

604 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