频道分类

delphi 播放背景音乐

作者:admin 来源: 日期:2018/2/7 16:07:34 人气: 标签:

 
//播放.MP3文件: 
 
uses
  mmsystem;
 
//開始播放: 
procedure TForm1.Button1Click(Sender: TObject); 
begin
MCISendString('OPEN e:\1.mp3 TYPE mpegvideo alias ww',nil, 0, 0); 
MCISendString('PLAY WW', nil, 0, 0); 
MCISendString('CLOSE ANIMATION', nil, 0, 0); 
end; 
 
//停止播放 
 
procedure TForm1.Button2Click(Sender: TObject); 
begin
MCISendString('OPEN e:\1.mp3 TYPE mpegvideo alias ww', nil, 0, 0); 
MCISendString('STOP ww', nil, 0, 0); 
MCISendString('CLOSE ANIMATION', nil, 0, 0); 
end;