Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

Which functions are available within Delphi to play a sound-file?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
953 views
Welcome To Ask or Share your Answers For Others

1 Answer

Here's the fastest way:

uses MMSystem;

procedure TForm1.Button1Click(Sender: TObject);
begin
  sndPlaySound('C:WindowsMediaTada.wav',
    SND_NODEFAULT Or SND_ASYNC Or SND_LOOP);
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
  sndPlaySound(nil, 0); // Stops the sound
end;

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...