Solved

Play waw file

Posted on 2000-03-04
8
642 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
 
LVL 1

Expert Comment

by:Indefrei
Comment Utility
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
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
LVL 1

Expert Comment

by:Indefrei
Comment Utility
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
Comment Utility
you should you what shame
sure, shame on you is shorter


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

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

Expert Comment

by:delphiexpert
Comment Utility
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
Comment Utility
PlaySound( ExtractFilePath( ParamStr( 0 ) + 'testsound.wav' ) ;

or it may be :

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

Tim.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

728 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now