FOLD

Top  Previous  Next

unit Fold;

 

interface

 

uses

SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,

Forms, Dialogs, ExtCtrls, MPlayer, DsgnIntf;

 

type

TFoldAVI = class(TPanel)

private

  FMediaPlayer: TMediaPlayer;

  FFileName:string;

  procedure SetFilename(value:String);

protected

  procedure MediaPlayer1Notify(Sender: TObject);

public

  constructor Create(AOwner:TComponent);override;

  destructor Destroy;override;

published

  property FileName:string read FFilename write SetFilename;

end;

 

Var FoldAVI: TFoldAVI;

 

procedure Register;

 

implementation

 

procedure Register;

begin

RegisterComponents('AL',[TFoldAVI]);

{  RegisterPropertyEditor(TypeInfo(string), TFoldAVI, 'FileName', TFileProperty);}

end;

 

constructor TFoldAVI.Create(AOwner:TComponent);

var MyErrorString: string;

begin

inherited Create(AOwner);

FMediaPlayer:= TMediaPlayer.Create(Self);

FMediaPlayer.Parent:=FoldAvi;

With FMediaPlayer do begin

     devicetype := dtAutoSelect;

     Display    := FoldAVI;

     AutoEnable := False;

     AutoOpen   := False;

     Visible    := False;

end;

{  Try

  FMediaPlayer.Open;

  FMediaPlayer.OnNotify := MediaPlayer1Notify;

except

  MyErrorString := 'Hibakód: ' + IntToStr(Error);

      MessageDlg(MyErrorString, mtError, [mbOk], 0);

end;}

{    Filename := 'FOLD.AVI';}

end;

 

destructor TFoldAVI.Destroy;

begin

FMediaPlayer.Free;

inherited Destroy;

end;

 

procedure TFoldAVI.SetFilename(value:String);

BEGIN

If FFilename<Value then begin

  If FileExists(Value) then begin

     FMediaPlayer.Filename:=Value;

     FFilename:=Value;

     FMediaPlayer.Open;

     FMediaPlayer.Play;

  end;

end;

end;

 

procedure TFoldAVI.MediaPlayer1Notify(Sender: TObject);

begin

FMediaPlayer.Play;

end;

 

end.