unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls,shellapi, MPlayer, StdCtrls;
type
TForm1 =
class(TForm)
Panel1: TPanel;
MediaPlayer1: TMediaPlayer;
Timer1: TTimer;
procedure FormCreate(Sender: TObject);
procedure MediaPlayer1Notify(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
uses Unit2;
{$R *.dfm}
procedure Delay(Milliseconds: Integer);
var
Tick: DWord;
Event: THandle;
begin
Event := CreateEvent(
nil, False, False,
nil);
try
Tick := GetTickCount + DWord(Milliseconds);
while (Milliseconds > 0)
and
(MsgWaitForMultipleObjects(1, Event, False, Milliseconds, QS_ALLINPUT) <> WAIT_TIMEOUT)
do
begin
Application.ProcessMessages;
if Application.Terminated
then Exit;
Milliseconds := Tick - GetTickcount;
end;
finally
CloseHandle(Event);
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
mediaplayer1.Play;
panel1.Align:=alclient;
borderstyle:=bsnone;
end;
procedure TForm1.MediaPlayer1Notify(Sender: TObject);
begin
if mediaplayer1.NotifyValue = nvSuccessful
then begin
mediaplayer1.Play;
end;
end;