当前位置:首页 > 网络编程 > 软件语言 > DELPHI > 循环播放音乐

循环播放音乐

点击次数:55 次 发布日期:2008-11-09 08:40:57 作者:源代码网
源代码网推荐
广告载入中
unit Unit1;
源代码网推荐
源代码网推荐 interface
源代码网推荐
源代码网推荐 uses
源代码网推荐 Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
源代码网推荐 MPlayer, StdCtrls;
源代码网推荐
源代码网推荐 type
源代码网推荐 TForm1 = class(TForm)
源代码网推荐 MediaPlayer1: TMediaPlayer;
源代码网推荐 Button1: TButton;
源代码网推荐 OpenDialog1: TOpenDialog;
源代码网推荐 procedure MediaPlayer1Notify(Sender: TObject);
源代码网推荐 procedure MediaPlayer1Click(Sender: TObject; Button: TMPBtnType;
源代码网推荐 var DoDefault: Boolean);
源代码网推荐 procedure Button1Click(Sender: TObject);
源代码网推荐 private
源代码网推荐 { Private declarations }
源代码网推荐 public
源代码网推荐 { Public declarations }
源代码网推荐 end;
源代码网推荐
源代码网推荐 var
源代码网推荐 Form1: TForm1;
源代码网推荐
源代码网推荐 implementation
源代码网推荐
源代码网推荐 {$R *.DFM}
源代码网推荐
源代码网推荐 procedure TForm1.MediaPlayer1Notify(Sender: TObject);
源代码网推荐 begin
源代码网推荐 with MediaPlayer1 do
源代码网推荐 begin
源代码网推荐 if Notify and //接受信息
源代码网推荐 (mode=mpStopped) then//已经停止
源代码网推荐 begin
源代码网推荐 ReWind;
源代码网推荐 play;
源代码网推荐 end;
源代码网推荐 notify:=true;//开始接受信息
源代码网推荐 end;
源代码网推荐
源代码网推荐 end;

源代码网推荐
源代码网推荐 procedure TForm1.MediaPlayer1Click(Sender: TObject; Button: TMPBtnType;
源代码网推荐 var DoDefault: Boolean);
源代码网推荐 begin
源代码网推荐 if (Button=btStop) or (Button=btPause) then
源代码网推荐 MediaPlayer1.Notify:=false
源代码网推荐 else
源代码网推荐 MediaPlayer1.Notify:=true;
源代码网推荐 end;
源代码网推荐
源代码网推荐 procedure TForm1.Button1Click(Sender: TObject);
源代码网推荐 begin
源代码网推荐 if OpenDialog1.Execute then
源代码网推荐 with MediaPlayer1 do
源代码网推荐 begin
源代码网推荐 fileName:=OpenDialog1.FileName;
源代码网推荐 notify:=true;
源代码网推荐 try
源代码网推荐 open;
源代码网推荐 play;
源代码网推荐 except
源代码网推荐 raise exception.Create("打开文件时出错");
源代码网推荐 end;
源代码网推荐 caption:="循环播放演示-->" fileName;
源代码网推荐 end;
源代码网推荐 end;
源代码网推荐
源代码网推荐 end.
源代码网推荐 窗体As text代码
源代码网推荐 object Form1: TForm1
源代码网推荐 Left = 195
源代码网推荐 Top = 107
源代码网推荐 Width = 378
源代码网推荐 Height = 182
源代码网推荐 Caption = "循环播放演示"
源代码网推荐 Color = clBtnFace
源代码网推荐 Font.Charset = DEFAULT_CHARSET
源代码网推荐 Font.Color = clWindowText
源代码网推荐 Font.Height = -11
源代码网推荐 Font.Name = "MS Sans Serif"
源代码网推荐 Font.Style = []
源代码网推荐 OldCreateOrder = False
源代码网推荐 PixelsPerInch = 96
软件开发网 www.mscto.com

源代码网推荐 TextHeight = 13
源代码网推荐 object MediaPlayer1: TMediaPlayer
源代码网推荐 Left = 24
源代码网推荐 Top = 16
源代码网推荐 Width = 298
源代码网推荐 Height = 33
源代码网推荐 TabOrder = 0
源代码网推荐 OnClick = MediaPlayer1Click
源代码网推荐 OnNotify = MediaPlayer1Notify
源代码网推荐 end
源代码网推荐 object Button1: TButton
源代码网推荐 Left = 193
源代码网推荐 Top = 104
源代码网推荐 Width = 129
源代码网推荐 Height = 33
源代码网推荐 Caption = "打开..."
源代码网推荐 Default = True
源代码网推荐 TabOrder = 1
源代码网推荐 OnClick = Button1Click
源代码网推荐 end
源代码网推荐 object OpenDialog1: TOpenDialog
源代码网推荐 Title = "打开音乐文件"
源代码网推荐 Left = 294
源代码网推荐 Top = 32
源代码网推荐 end
源代码网推荐 end
源代码网推荐 ////////////////////////////////////////////////////
源代码网推荐
源代码网推荐 if FileExists(ExtractFilePath(Application.Exename) "RunLibT01.AVI") then
源代码网推荐 begin
源代码网推荐 MediaPlayer1.FileName:=(ExtractFilePath(Application.Exename) "RunLibT01.AVI");
源代码网推荐 MediaPlayer1.Open;
源代码网推荐 MediaPlayer1.Notify:=true;
源代码网推荐 MediaPlayer1.Display:=Form2;
源代码网推荐 MediaPlayer1.DisplayRect:=Form2.ClientRect;
源代码网推荐 MediaPlayer1.Play;
源代码网推荐 end;
源代码网推荐
源代码网推荐 然后如下让它循环
源代码网推荐 procedure TForm2.MediaPlayer1Notify(Sender: TObject);


源代码网推荐 begin
源代码网推荐 if MCIStop=1 then Exit;
源代码网推荐 if MediaPlayer1.Mode=mpStopped then
源代码网推荐 begin
源代码网推荐 MediaPlayer1.Rewind;
源代码网推荐 MediaPlayer1.Play;
源代码网推荐 end;
源代码网推荐 MediaPlayer1.Notify:=true;
源代码网推荐 end;


源代码网推荐

源代码网供稿.
上一篇: 生成一个波文件  下一篇: 播放背景音乐
网友评论 (0)
会员中心
网络编程
本站推荐
网络编程之精华