Solved

Resource Help needed...

Posted on 1998-09-12
7
127 Views
Last Modified: 2012-05-04
How can I put Wave File in resource and
then load it with Delphi 3.0 Application?
0
Comment
Question by:kaloyan
  • 4
  • 2
7 Comments
 
LVL 1

Expert Comment

by:duke_n
ID: 1339539
Why don't you load it as it is?
0
 
LVL 10

Accepted Solution

by:
viktornet earned 20 total points
ID: 1339540
Try to do the following:
1. Create a text file with .RC extension;
2. Write thie single line into it
    MyWavFile WAV_RESOURCE "WavFileName.wav"
3. Save it and compile it with BRCC32.EXE which will create a .RES file;
4. Include the .RES file into your project file like this {$I MYWAVRES.RES},
for example; and
5. Use this routine to load it

function LoadWavResource : pointer;
var  resrc           : HRSRC;
       global          : HGLOBAL;
       ResrcSize    : DWORD;

begin
        resrc:= FindResource(Application.Handle,'MyWavFile','WAV_RESOURCE');
        if resrc = 0
           then Result:= nil
           else begin
              global:= LoadResource(Application.Handle,resrc);
              if global = 0
                 then Result:= nil
                 else begin
                    ResrcSize:= SizeofResource(Application.Handle,resrc);
                    if ResrcSize = 0
                       then Result:= nil
                       else Result:= LockResource(global);
                 end;
           end;
end;
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1339541
Raboti li tazi procedura???

Regards,
Viktor Ivanov
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:kaloyan
ID: 1339542
Yes it works perfect. Thanks!
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1339543
No prob! You are from Bulgaria, right??? I've seen only a few Bulgarians around here =)

Regards,
Viktor Ivanov
0
 

Author Comment

by:kaloyan
ID: 1339544
Yes I am from Bulgaria!
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1339545
Ok, thanks for answering :-)
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
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…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

685 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