网站首页/技术开发列表/内容

完成avi全屏播放

技术开发2022-05-16阅读
uses Unit2;

procedure TForm1.Button1Click(Sender: TObject);
begin
  Form2.Show;
  Form2.WindowState := wsMaximized;
  Form2.MediaPlayer1.Notify := false;
  Form2.MediaPlayer1.Display := Form2.Panel1;
  Form2.MediaPlayer1.FileName := 'C:\TheWall\DELCAR2.AVI';
  Form2.MediaPlayer1.Open;
  Form2.MediaPlayer1.DisplayRect := Form2.ClientRect;
  Form2.MediaPlayer1.Play;
end;

{Code for Form 2}

procedure TForm2.MediaPlayer1Notify(Sender: TObject);
begin
  if MediaPlayer1.NotifyValue = nvSuccessful then
    Form2.Close;
end;
//////////////////////////////////////////////////////

  public
    { Public-Deklarationen }
    procedure MMNotify(var Message: TMessage); message MM_MCINOTIFY;
  end;

var
  Form1 : TForm1;

implementation

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);
begin
  mciSendString('open j:\video.avi alias film', nil, 0, 0);
  mciSendString('window film handle 0', nil, 0, 0);
  mciSendString('window film state show maximized', nil, 0, 0);
  mciSendString('play film notify', nil, 0, Form1.Handle);
end;

procedure TForm1.MMNotify(var Message: TMessage);
begin
  mciSendString('close film', nil, 0, 0);
end;

……

相关阅读