Solved

Delphi 3 playing a .wav file

Posted on 1998-09-23
3
176 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
Comment Utility
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
Comment Utility
You can also do this....

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

Regards,
Viktor Ivanov
0
 
LVL 4

Expert Comment

by:itamar
Comment Utility
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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

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…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

744 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

16 Experts available now in Live!

Get 1:1 Help Now