Solved

Delphi 3 playing a .wav file

Posted on 1998-09-23
3
179 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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
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 Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …

813 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

13 Experts available now in Live!

Get 1:1 Help Now