Solved

Play waw file

Posted on 2000-03-04
8
646 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
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

828 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