unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 =
class(TForm)
Button1: TButton;
Button2: TButton;
Button3: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
uses
mmSystem;
{$R *.dfm}
procedure PlayMySound(SndName:
String);
//uses mmSystem
var
FilePath:
String;
begin
FilePath := ExtractFilePath(ParamStr(0)) + '
Sounds\' + SndName + '
.wav';
if FileExists(FilePath)
then
//SndPlaySound(PAnsiChar(FilePath), SND_ASYNC ); //Alternative
PlaySound(PChar(FilePath), hInstance, SND_ASYNC
or SND_FILENAME);
end;
procedure TForm1.Button1Click(Sender: TObject);
//spielt Sound 1
begin
PlayMySound('
wav1');
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
//spielt Sound 2
PlayMySound('
wav2');
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
//spielt Sound 3
PlayMySound('
wav3');
end;
end.