Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 653
  • Last Modified:

Play waw file

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
SwOoPe
Asked:
SwOoPe
  • 3
  • 2
  • 2
  • +1
1 Solution
 
delphiexpertCommented:
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
 
SwOoPeAuthor Commented:
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
 
IndefreiCommented:
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
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!

 
IndefreiCommented:
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
 
IndefreiCommented:
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
 
SwOoPeAuthor Commented:
you should you what shame
sure, shame on you is shorter


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

what the f**k is that ??
0
 
delphiexpertCommented:
I think what he means to say is, try offering more points if you want to get a decent answer.
0
 
AttarSoftwareCommented:
PlaySound( ExtractFilePath( ParamStr( 0 ) + 'testsound.wav' ) ;

or it may be :

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

Tim.
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!

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