• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 136
  • Last Modified:

Resource Help needed...

How can I put Wave File in resource and
then load it with Delphi 3.0 Application?
0
kaloyan
Asked:
kaloyan
  • 4
  • 2
1 Solution
 
duke_nCommented:
Why don't you load it as it is?
0
 
viktornetCommented:
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
 
viktornetCommented:
Raboti li tazi procedura???

Regards,
Viktor Ivanov
0
Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

 
kaloyanAuthor Commented:
Yes it works perfect. Thanks!
0
 
viktornetCommented:
No prob! You are from Bulgaria, right??? I've seen only a few Bulgarians around here =)

Regards,
Viktor Ivanov
0
 
kaloyanAuthor Commented:
Yes I am from Bulgaria!
0
 
viktornetCommented:
Ok, thanks for answering :-)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now