Solved

Delphi 3 playing a .wav file

Posted on 1998-09-23
3
177 Views
Last Modified: 2010-04-06
Please can you give me the code to attach to a button's on click event handler that will enable me to play a (wav)sound file as i would like to add sounds to my applications. many thanks phil from London.
0
Comment
Question by:alix
  • 2
3 Comments
 
LVL 4

Accepted Solution

by:
itamar earned 100 total points
ID: 1340705
Hi alix,

just drop a TMediaPlayer (from System VCL pallete) in your form and make it invisible.

And the code is:

procedure TForm1.Button1Click(Sender: TObject);
begin
  MediaPlayer1.FileName := 'C:\WINDOWS\MEDIA\CHIMES.WAV';
  MediaPlayer1.Open;
  MediaPlayer1.Play;
end;

IHTH,
Itamar
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1340706
You can also do this....

PlaySound(PChar('The path'), 0, snd_Async);

Regards,
Viktor Ivanov
0
 
LVL 4

Expert Comment

by:itamar
ID: 1340707
Well, follow this link to have a complete picture in this subject;

http://www.inprise.com/devsupport/delphi/ti_list/TI3099.html

ISTH (I'm Sure This Helps ;-D )
Itamar
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

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…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

932 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

18 Experts available now in Live!

Get 1:1 Help Now