Solved

Play waw file

Posted on 2000-03-04
8
645 Views
Last Modified: 2008-03-17
How do I play a waw file from my program if the waw fille is not in the same directory as the program file?

For axample the file is located in:

C:\My program\Sounds
0
Comment
Question by:SwOoPe
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 1

Accepted Solution

by:
delphiexpert earned 5 total points
ID: 2584431
I assume you mean wav file.
Just use the full path as well as the filename, eg
PlaySound('C:\My program\Sounds\sound.wav');


0
 

Author Comment

by:SwOoPe
ID: 2585264
The problem is that I dont know what path my program will be installd in during setup it kan be any thing.

C:\Music\Sound   or   D:\mp3\Sounds

How do I get the install dir + Sounds
0
 
LVL 1

Expert Comment

by:Indefrei
ID: 2585642
So,
this is not a q about playing sound
but about installing
while installing write your soundpath into the registry
and read it after starting your program
You should ask, how to do that
Regards
Indi
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 1

Expert Comment

by:Indefrei
ID: 2585677
E.G.
Procedure TForm1.Button1Click(Sender: TObject);
var
    reg: TRegistry;
begin
           reg := TRegistry.Create;
           reg.RootKey := HKEY_CLASSES_ROOT;
           reg.LazyWrite := false;
           {Add Program Support}
           reg.OpenKey('.bor\shell\open\command', true);
           {Invoke the program passing the file name as the first parameter}
                      reg.WriteString('', 'C:\Program Files\Borland\Delphi 3\Project1.exe   %1');
                    {Add Icon Display}
            reg.CloseKey;
            reg.OpenKey('.bor\DefaultIcon', true);
           {Use the first icon in the executable to display}
            reg.WriteString('', 'C:\Program Files\Borland\Delphi
            3\Project1.exe,0');
            reg.CloseKey;
            reg.free;
end;

hope this gives you some guide lines...:-)
add registry to your uses clause...

                    uses
                     Windows, Forms,..., Registry;
0
 
LVL 1

Expert Comment

by:Indefrei
ID: 2585690
Hey, you bas....
right now i saw that you offered just 5 points
as we would say,
you should you what shame
sure, shame on you is shorter
0
 

Author Comment

by:SwOoPe
ID: 2585870
you should you what shame
sure, shame on you is shorter


?????????????????????????????

what the f**k is that ??
0
 
LVL 1

Expert Comment

by:delphiexpert
ID: 2586161
I think what he means to say is, try offering more points if you want to get a decent answer.
0
 
LVL 1

Expert Comment

by:AttarSoftware
ID: 2592233
PlaySound( ExtractFilePath( ParamStr( 0 ) + 'testsound.wav' ) ;

or it may be :

PlaySound( ExtractFilePath( ParamStr( 0 ) + '\testsound.wav' ) ;

Tim.
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Suggested Solutions

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

777 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